*
The moose likes Servlets and the fly likes when and how to use a 'head' request? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "when and how to use a Watch "when and how to use a New topic
Author

when and how to use a 'head' request?

Vanchi Nathan
Ranch Hand

Joined: Feb 24, 2004
Posts: 107
Hello,

Would anyone advice me when and how i can use the 'head' request.. that will invoke the doHead() method on a servlet?

Pl. brief what is the effect of the response made within the 'doHead()' method.

Thanks in adv...


Best regards,<br /> <br />vanchin
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
From the HTTP 1.1 documentation RFC2616
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The
metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the
information sent in response to a GET request. This method can be used for obtaining metainformation about the
entity implied by the request without transferring the entity-body itself. This method is often used for testing
hypertext links for validity, accessibility, and recent modification.
The response to a HEAD request MAY be cacheable in the sense that the information contained in the response MAY
be used to update a previously cached entity from that resource. If the new field values indicate that the cached entity
differs from the current entity (as would be indicated by a change in Content-Length, Content-MD5, ETag
or Last-Modified), then the cache MUST treat the cache entry as stale.

I think the most important use is to determine the last modification date of a page to save on bandwidth and CPU time.
Bill
[ May 29, 2004: Message edited by: William Brogden ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"Vanchin Vanchin",
Sorry, but your name does not comply to the JavRanch naming rules. Please see them here.

We require your display name to be two words: your first name, a space, then your last name. Obviously fictitious names are not allowed. Please edit your profile and fix you display name.

Accounts with invalid display names get deleted, often without warning, and you have 33 posts with an invalid display name. Your account is likely to be closed soon, so please update your display name immediately.

thanks, Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: when and how to use a 'head' request?
 
Similar Threads
doHead question?
HTTP method HEAD arriving at servlet as GET .....
HEAD requests.
regrd doHead()
GET and HEAD requests