• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

when and how to use a 'head' request?

 
Vanchi Nathan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic