title: Adding custom headers in Jersey Filters isn't working
body: <p>I am new to DropWizard framework and Jersey in general. So I could be completely off the track with what I am trying to accomplish here. </p>
  
  <p>I am running into an issue where the parameters I add to my request header through a pre-matching Request filter are not reaching the custom provider for my AuthCredentials object.  I am trying to provide a AuthCredentials object for every resource that requires auth from the header parameters . Since one of the services I am going to rely on for providing auth headers isn't ready yet i am faking them out by adding them in the pre-matching request filter myself.</p>
  
  <p>Here's my code</p>
  
  <pre><code> @PreMatching
   @Provider
   class MyFilter implements ContainerRequestFilter{
     @Override
     public void filter(ContainerRequestContext requestContext) throws IOException {
          requestContext.getHeaders().add("param1", "value1");
     }
  }
  
  
  class MyAuthCredentialsFactory implements Factory&lt;AuthCredentials&gt;{
       @Inject
       public MyAuthCredentialsFactory(HttpServletRequest request){
            System.out.println("Param1 header value = " + request.getHeader("param1")); // &lt;---This prints null
       }
  }
  </code></pre>
  
  <p>I am registering these classes in my applications' run method in drop wizard framework as shown below.</p>
  
  <pre><code>@Override
      public void run(ServerConfigType configuration,
                      Environment environment) {
          environment.jersey().register(new AbstractBinder() {
                 @Override
                 protected void configure() {
                    bindFactory(MyAuthCredentialsFactory.class).to(AuthCredentials.class).in(RequestScoped.class);               
                 }
      });
      environment.jersey().register(MyFilter.class);
  </code></pre>
  
  <p>My resource uses auth credentials like this</p>
  
  <pre><code>@Path("/pathtomyresource")
  public class MyApi {
      @Inject AuthCredentials authCredentials;
  }
  </code></pre>
  
  <p>I am using DropWizard 0.8.3, and Jackson 2.5.3.</p>
  
  <p>When I print the value of the param1 from the header I am getting a null. I looked at the HttpServletRequest's header names in the debugger, and didn't find the param1 in there which explains why the value is null.  I did a lot of research on the internet on this and found that it should work but isn't working for me. At this point I am puzzled and I would really appreciate any help with this.</p>