title: JAX-RS interface markup and @Context injection
body: <p>Consider the following simple RESTEasy (JAX-RS) service:</p>
  
  <pre><code>@Path("/example-service")
  public interface ExampleService {
  
      @Path("/ping")
      @GET
      public String ping(String message);
  
  }
  </code></pre>
  
  <p>I want to define JAXRS specifics on the interface rather than the class so I can use the nice client framework, ie:</p>
  
  <pre><code>ExampleService client = ProxyFactory.create(ExampleService.class, "http://localhost:8080");
  </code></pre>
  
  <p>Everything works well, except for when I want to introduce some of RESTEasy's context injections, ie: @Context.  Naively, consider the following:</p>
  
  <pre><code>@Path("/example-service")
  public interface ExampleService {
  
      @Path("/ping")
      @GET
      public String ping(@Context HttpServletRequest request, String message);
  
  }
  </code></pre>
  
  <p>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: <a href="https://jira.jboss.org/jira/browse/RESTEASY-311" rel="nofollow noreferrer">RESTEASY-311</a>)</p>
  
  <p>How can I use interface JAXRS markup (and therefore leverage the nice RESTEasy client framework) and access orthogonal @Context injections at the same time?</p>