Nevermind, i had forgotten to:
HttpClient client = new HttpClient();
client.executeMethod(head);

:)



--- "Khalid K." <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> I am trying to use HeadMethod to get 'last-modified'
> header from response, and it always returns NULL.
> 
> Doesn't matter what site/page is passed to the
> constructor, see the code below.
> 
> a very rough test (calling from jsp), any help is
> appreciated :)
> 
> <%
> System.out.println("calling head");
> HeadMethod head = new
>
HeadMethod("http://jakarta.apache.org/commons/httpclient/apidocs/index.html";);
> if (head == null)  {
>       System.out.println("head is null");
>       return;
>       }
> 
> Header header =
> head.getResponseHeader("last-modified");
> if (header == null) {
>       System.out.println("header for last-modified is
> null");
>       return;
> }
> String lastModified =
> head.getResponseHeader("last-modified").getValue();
> System.out.println(lastModified);
> %>
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to