• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Overridding service() method!??

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I read in some book that overridding the service() is not a good idea. But I seen some codings in which service() method has been overridden.
I want to know when it is needed to override the service() method. If we are overridding the service() method, what about doGet() and doPost().?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you are talking about the service method in an HttpServlet, then the answer is probably in the code where you've seen this happen. Basically all the service method does is delegates to the appropriate doXXX() method depending on the request. Since HTTP changes only very occasionally, it's very unlikely that you will need to alter its behaviour.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't even remember why we did it that way now, but in the early pre-Struts, pre-filter days we had an abstract Front Controller-like class that did something like this:



Not quite the same though.
    Bookmark Topic Watch Topic
  • New Topic