title: How to add a header to HTTP request using a filter in JAX-RS?
body: <p>I'm modifying a<code>HttpRequest</code> on my <code>WebFilter</code> by adding a single header to <code>request</code> using a <code>HttpServletRequestWrapper</code> implementation class:</p>
  
  <pre><code>HeaderMapRequestWrapper requestWrapper = new HeaderMapRequestWrapper(request);
  requestWrapper.addHeader(OAuth.OAUTH_ACCESS_TOKEN, accessTokenWord);
  chain.doFilter(requestWrapper, response);
  </code></pre>
  
  <p>After <code>doFilter(requestWrapper, response)</code> is performed, JAX-RS leads request to its resource, which has a <code>@RequestScoped</code> field:</p>
  
  <pre><code>@Inject
  protected HttpServletRequest request;
  </code></pre>
  
  <p>However, it doesn't contain any expected header:</p>
  
  <pre><code>@PostConstruct
  protected void initialize_resources() throws IllegalStateException {
  
      this.currentUser = null;
      String accessToken = this.request.getHeader(OAuth.OAUTH_ACCESS_TOKEN);
      AccessToken accessToken = this.memcachedResources.getMemcachedAccessTokenRepository()
                                    .get(accessToken);
  
      if (accessToken != null &amp;&amp; StringUtils.isNotEmpty(accessToken.getUser_id())) {
          this.currentUser = this.em.find(User.class, accessToken.getUser_id());
          this.currentClient = accessToken.getClientId();    
      }
  }
  </code></pre>
  
  <p>So, <code>this.request.getHeader(OAuth.OAUTH_ACCESS_TOKEN)</code> is <code>null</code>.</p>
  
  <p>How can I solve that?</p>