Consider the following simple RESTEasy (JAX-RS) service:
@Path("/example-service")
public interface ExampleService {
@Path("/ping")
@GET
public String ping(String message);
}
I want to define JAXRS specifics on the interface rather than the class so I can use the nice client framework, ie:
ExampleService client = ProxyFactory.create(ExampleService.class, "http://localhost:8080");
Everything works well, except for when I want to introduce some of RESTEasy's context injections, ie: @Context. Naively, consider the following:
@Path("/example-service")
public interface ExampleService {
@Path("/ping")
@GET
public String ping(@Context HttpServletRequest request, String message);
}
This obviously doesn't make sense because this @Context injection is orthogonal and doesn't belong on the interface (furthermore, even if I can get past the ugliness of this interface from the client perspective and pass null, there is currently a bug preventing this from working: RESTEASY-311)
How can I use interface JAXRS markup (and therefore leverage the nice RESTEasy client framework) and access orthogonal @Context injections at the same time?