title: how to use HEAD method of HTTPClient to get all headers
body: <p>I have to use <code>HEAD</code> method of <code>HttpClient</code> to get the header field and to check the "last-modified" date of server file.<br/>
  I am not able to get that, if you know how to get the header field then please reply.
  How to get the "last-modified" header into the String object for the comparison. </p>
  
  <p>Here is my code: </p>
  
  <pre><code>HttpClient client = new DefaultHttpClient();
  //HttpGet get = new HttpGet(url);
  HttpHead method = new HttpHead(url);
  HttpResponse response= client.execute(method);
  
  Header[] s = response.getAllHeaders();
  
  System.out.println("THe header from the httpclient:");
  for(int i=0; i &lt; s.length; i++){
      Header hd = s[i];
      System.out.println("Header Name: "+hd.getName()
                          +"       "+" Header Value: "+ hd.getValue());
  }
  </code></pre>