title: How to get headers? (java,httpclient 4.X)
body: <p>When I do:</p>
  
  <pre><code>Header[] h = first.getAllHeaders();
  </code></pre>
  
  <p>The returned <code>Header</code> array is empty. Any ideas? Below is my code.</p>
  
  <hr/>
  
  <pre><code>HttpClient httpclient = new DefaultHttpClient();
  
  CookieStore cookieStore = new BasicCookieStore();
  
  // Create local HTTP context
  HttpContext localContext = new BasicHttpContext();
  // Bind custom cookie store to the local context
  localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
  
  
  HttpGet first = new HttpGet("http://vk.com");
  HttpResponse response = httpclient.execute(first, localContext);
  
  InputStream instream = response.getEntity().getContent();
  StringBuilder sb = new StringBuilder();
  BufferedReader r = new BufferedReader(new InputStreamReader(instream, Charset.forName("windows-1251")));
  for (String line = r.readLine(); line != null; line = r.readLine()) {
      sb.append(line);
  }
  Header[] h = first.getAllHeaders();
  instream.close();
  String s = sb.toString();
  </code></pre>