title: HttpServletResponse with @Context annotation always null
body: <p>I'm new to JAX-RS and I'm trying to understand how the @Context annotation works. I have a REST service and am currently using certain filters to do extra processing for different request types. Inside one of those filters is the following line:</p>
  
  <pre><code>public class SentryFilter {
       @Context
       HttpServletResponse response;
  
  ...
  </code></pre>
  
  <p>This value is used later on in the <code>filter()</code> method of that filter. The problem is that the response object is null. I've stepped through a debugger and can't determine why it's null. </p>
  
  <p>From what I've read in the JAX-RS documentation, the @Context annotation for HttpServletResponse can be filled by the resource methods. So, I modified my the API I'm calling to include HttpServletResponse</p>
  
  <pre><code>public interface APIStuff {
      @Path("deviceName")
          @GET
          @Sentry
          String getDeviceName(@PathParam("deviceId") @Size(min = 1, max = 1024) final String deviceId, @Context HttpServletResponse httpServletResponse);
  
      ...
  </code></pre>
  
  <p>This returns the same HttpServletResponse is null error. </p>
  
  <p>So the question is, where is this value supposed to be "filled"? The person who wrote the filter class obviously did so with the belief that the <code>response</code> object would be filled, so I don't think it's a matter of passing in <code>@Context HttpServletResponse</code> to the <code>filter()</code> method. </p>