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

overriding service() method in HttpServlet

 
amarjeet kumar
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if we extend Httpservlet in our servlet program then as i know do...() method is used which in turn extends service()method implicitly.But i have made a program in which service() method has been overloaded in HttpServlet.Can anyone tell me how it works Please.

thanks
amar
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't understand the implications of overriding service(), why would you do it?

And with regards to:

as i know do...() method is used which in turn extends service()method implicitly


Overloading any of the doXXX() methods does not "implicitly extend" service(), whatever "implicitly extend" means.
[ October 22, 2006: Message edited by: Bear Bibeault ]
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by amarjeet kumar:
if we extend Httpservlet in our servlet program then as i know do...() method is used which in turn extends service()method implicitly.But i have made a program in which service() method has been overloaded in HttpServlet.


service method is the one which delegates the call to the respective doXXXX method accroding to the request.getMethod().So in case you override the service method the delegation is not taking place and you code is getting executed and the results you are positive.
 
Durgaprasad
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the sequesnce is

firstly, service(ServletRequest,ServletRespone) will be called which in turn calls service(HttpServletRequest,HttpServletResponse) which based on the type of the method(Get,Post etc..) will call the appropriate doXXX() method
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Durgaprasad,
Welcome to JavaRanch!

We're pleased to have you here with us in the servlets forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here
[ October 25, 2006: Message edited by: Ben Souther ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic