File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet LifeCycle?

 
Joe Harry
Ranch Hand
Posts: 10047
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I have a small doubt is that what is the actual need of the service method since we are not doing anything with that?? I mean, we only override doGet or doPost...so why do we actually need the service method even?? This may be a silly question but I could not refrain myself from asking it.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no silly question.
And the answer is in the FAQ:
http://faq.javaranch.com/view?ServletsFaq#9
 
Joe Harry
Ranch Hand
Posts: 10047
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So as per the faq says, "The only thing the service method does is examining the HTTP method, and based on that, dispatch the request to the various doXYZ methods" is the real purpose of service method!

Thanks Satou. You have been really helpful!
 
Rajesh Seeram
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

"The only thing the service method does is examining the HTTP method, and based on that, dispatch the request to the various doXYZ methods"

This statement is only applicable to HttpServlet not for Generic Servlet. As HttpServlet is implemented for HTTP Protocol, where as if you want to implement a Servlet for SMTP or some other protocol you need a service method.
 
Joe Harry
Ranch Hand
Posts: 10047
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rajesh for the explanation. It got my doubt cleared!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic