title: How to Handle the Session in Apache HttpClient 4.1
body: <p>I am using the HttpClient 4.1.1 to test my server's REST API.</p>
  
  <p>I can manage to login seem to work fine but when I try to do anything else I am failing.</p>
  
  <p>Most likely I have a problem setting the cookie in the next request.</p>
  
  <p>Here is my code currently:</p>
  
  <pre><code>HttpGet httpGet = new HttpGet(&lt;my server login URL&gt;);
  httpResponse = httpClient.execute(httpGet)
  sessionID = httpResponse.getFirstHeader("Set-Cookie").getValue();
  httpGet.addHeader("Cookie", sessionID);
  httpClient.execute(httpGet);
  </code></pre>
  
  <p>Is there a better way to manage the session/cookies setting in the HttpClient package?</p>