my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes About doGet() adn doHead() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "About doGet() adn doHead()" Watch "About doGet() adn doHead()" New topic
Author

About doGet() adn doHead()

Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
Dear all,
If I have servlet class that have method doGet() and doHead(), which method from both will be called by container to allow its servlet to handle a HEAD request?
thanks
daniel
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Check out the API for HttpServlet.
doGet() is called by the service() method to handle GET requests.
doHead() is called by the service() method to handle HEAD requests.
Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
I have read the API of HttpServlet.
In doGet() method, It say that
"Overriding this method to support a GET request also automatically supports an HTTP HEAD request"
Back to my question before, If I have servlet class that have method doGet() and doHead(), which method from both will be called by container to allow its servlet to handle a HEAD request?
daniel
Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
Your doHead() will handle the HEAD requests, and the doGet() will service the GET requests.
doGet() will handle HEAD requests in the absence of an overridden doHead() method.
Well that's what I was told anyway
Try it out.
 
jQuery in Action, 2nd edition
 
subject: About doGet() adn doHead()
 
Similar Threads
doHead() method calls??
HTTP method HEAD arriving at servlet as GET .....
HEAD requests.
how to access other than doGet and doPost
Just wanted to share this....about doGet