У меня работает следующее.
RESTEasy корневой контекст:
package com.foo.rest;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/rest")
public class RestServiceLocator extends Application {
}
STLS bean:
package com.foo.rest;
import javax.ejb.EJB;
import javax.ejb.Local;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
@Path("/foo")
@Stateless
@LocalBean //Note: @Local(FooResource.class) does not let RESTEasy to load EJB!
public class FooResourceBean implements FooResource {
@EJB
private FooResourceBean h; // Works!
/**
* http://localhost:8080/webapp/rest/foo/baa
*
*/
@GET
@Path("/baa")
@Produces("application/json")
@Override
public Response baa() {
String json = "{ \"baa\" : [ " +
" { \"icon\":\"source1.png\" , \"description\":\"Source 1\" }, " +
" { \"icon\":\"source2.png\" , \"description\":\"Source 2\" }, " +
" { \"icon\":\"source3.png\" , \"description\":\"Source 3\" } " +
" ]}\";";
return Response.ok(json).build();
}
}