• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HEAD

 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what will happen if a servlet is called with HEAD method but the doHead method is not present?

david's book says that we will get a 200 response code:SC_OK....is it right? but if this was for post method then we would get 405: method not allowed
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have read somewere here that doHead calls doGet method....if there is no doHead ten doGet is called....but what if both of them are not present? what repsonce code will i get...am reall confused about the reposnce codes..can someone help me with them..thanks
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the servlet does not implement doHead , doGet will be called upon HTTP HEAD request.............is this right?
 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think service method invokes doGet() in case doHead() method is not available in the servlet. Need to test it.

when HTTP head method is used then response header is exactly similar to the response header which will be sent when HTTP Get method is used. Only difference is, response header is not having any message body when Head method is used.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic