Consider the following simple RESTEasy service (JAX-RS):
@Path("/example-service")
public interface ExampleService {
@Path("/ping")
@GET
public String ping(String message);
}
I want to define the specifics of JAXRS on the interface, not on the class, so I can use a beautiful client structure, that is:
ExampleService client = ProxyFactory.create(ExampleService.class, "http://localhost:8080");
Everything works well, except when I want to inject some RESTEasy context injections, i.e.: @Context. We naively consider the following:
@Path("/example-service")
public interface ExampleService {
@Path("/ping")
@GET
public String ping(@Context HttpServletRequest request, String message);
}
This obviously does not make sense, because this @Context injection is orthogonal and does not belong to the interface (moreover, even if I can overcome the ugliness of this interface from the client's point of view and pass null, there is currently an error preventing this from working: RESTEASY- 311 )
JAXRS (, , RESTEasy) @Context?