wood burning stoves*
The moose likes Servlets and the fly likes Simple question on service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Simple question on service" Watch "Simple question on service" New topic
Author

Simple question on service

Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
In ServletAPI it is given for doGet,doPost .......methods that they are called via service method???What does this mean?When exactly service method is called?When request is made for a particular servlet?I am sorry if I have confused.
Thanks
Veena


SCJP1.4
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
The service method is called any time a HTTP request arrives at the server which is mapped to that servlet.
The servlet container decodes each request, creates HttPRequest and HttpResponse objects and calls service. The service method examines the request, and chooses the correct one of doGet, doPost, doHead etc. to call.
Does that make sense?


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
Thanks Frank.Actually super class's service method is called right?I mean the one in HttpServlet class?
Thanks again.
Veena.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
In general, yes.
All teh servlet container knows how to do is call the "service(HttpRequest, HttpResponse) method. By default, the one from HttpServlet is used, but if you override this method in your own servlet, that one will be called instead.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple question on service