title: get Header in jersey from a GET request
body: <p>From a js page (in angular) I call a REST request, GET method, were I would to pass an header, this is the function that I call from the REST request:</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>        allstaffworking: function(_getstaff){
              var currentToken = _GetToken();
  
              var Headers = {
                  token: currentToken.stringtoken
              };
  
              console.log("idtoken"+Headers);
  
              if (currentToken !== null) {
              $http({  
                          method : 'GET',  
                          headers: Headers,
                          url : REST_URL+'staff/working'
                      }).then(function successCallback(response) {  
                          _getstaff(response)
                      }, function errorCallback(response) {  
                          console.log(response.statusText);  
                      });  
                 }  else {
                  console.log("NON SEI LOGGATO!!!");
              }
          },
  </code></pre>
  
  <p>Whithout <code>headers: Headers,</code> it works, but I want to pass an important json string: <code>{"idtokenStaff":11,"staffType":{"idstaffType":2,"type":"Dipendente"},"tokenStaff":"88d08m8ve4n8i71k796vajkd01"}</code> in the Headers. I don't know How I can take this string in Jersey. This is java file in with I have the REST method:</p>
  
  <pre><code> @Path("/staff")  
  public class StaffController {  
  
  BaseDao sDao =  new StaffDaoImpl();
  StaffDao stfDao =  new StaffDaoImpl();
  TokenStaffDao tsDao = new TokenStaffDaoImpl();
  TokenStaff ts = new TokenStaff();
  
      @GET  
      @Produces(MediaType.APPLICATION_JSON)  
   public List&lt;Staff&gt; getStaff()  
   {  
  
    List&lt;Staff&gt; listOfStaff=sDao.getAll(Staff.class);
    return listOfStaff;  
   }  
  
      @GET  
      @Path("/working")  
      @Produces(MediaType.APPLICATION_JSON)
      @Consumes("application/json")
      public List&lt;Staff&gt; getWStaff(@HeaderParam("token") String token) throws JSONException  
   {  
  
          JSONObject jsonObj = new JSONObject(token);
  
      Boolean id = tsDao.getExistence(jsonObj.getInt("idtokenStaff"));
      if (id){
          List&lt;Staff&gt; listOfWStaff=stfDao.getAllW();
          return listOfWStaff;  
      }
      else
          return null;
   }
  }
  </code></pre>
  
  <p>Taking header from: <code>@HeaderParam("token") String token</code>. How Can I take the element of the header?</p>