title: Custom response header Jersey/Java
body: <p>I am trying to achieve the following.</p>
  
  <p>Read a custom header and its value from Request:</p>
  
  <pre><code>name: username
  </code></pre>
  
  <p>Now, on response, I would like to return the same header <code>name:value</code> pair in HTTP response.</p>
  
  <p>I am using Jersey 2.0 implementation of JAX-RS webservice.</p>
  
  <p>When I send the request URL <code>Http://localhost/test/</code>, the request headers are also passed (for the time being, though Firefox plugin - hardcoding them). </p>
  
  <p>On receiving the request for that URL, the following method is invoked:</p>
  
  <pre><code>@GET
  @Produces(MediaType.APPLICATION_JSON)
  public UserClass getValues(@Context HttpHeaders header) {
      MultivaluedMap&lt;String, String&gt; headerParams = header.getRequestHeaders();
      String userKey = "name";
      headerParams.get(userKey);
  
      // ...
  
      return user_object;
  }
  </code></pre>
  
  <p>How may I achieve this? Any pointers would be great!</p>