Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regrd doHead()

 
mysha ahamed
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have a dbt regd doHead().
Its given tht..
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response.

So my dbt is while writing logic for doHead() is it tht we shuldnt write any code for response body or even if v write the server sends only response headers n status code to the client..

i have just written a sample doHead() n i can view the respose body frm the browser..Can anyone pls explain the functionality of this method..

Thnx.
mysha
 
Mat Williams
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As a general rule don't override doHead(). My understanding is that most servers will pass a doHead() request through to doGet() (which you may override) and then only return the header components of the doGet() response.

If you override it I believe that it is just the same as a doGet() although the client may not like the response (if it is not a web browser as the client, but instead a web spider, or other similar tool) and complian.

Mat
 
PNS Subramanian
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

My understanding is that most servers will pass a doHead() request through to doGet()


This is what i observed when i tried setting action="HEAD" in my JSP page calling a servlet with doGet and doPost implemented. Infact, all calls except the one with action="POST" were directed to doGet() method.

This raises a question - how/where do we use doHead() method then ?
 
mysha ahamed
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
ya,I have the same dbt ,how n where shuld we use doHead() then if head is invoked by doGet();
Thnx
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic