• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why HTTPServlet class is abstract?

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just found that HTTPServlet class doesn't contain any abstract methods but still it is declared as an abstract class. Can anyone please suggest a reason for marking this class as ABSTRACT.
 
Ranch Hand
Posts: 308
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because HttpServlet is not designed to solve all web sites specific problems.

Every java programmer will write she/he's own java concrete servlet for her/his purpose, extending it, and taking advantage from the http protocol facilites, already implemented and ready to use, provided by the superclass HttpServlet.

Hope this helps a bit.

 
Bartender
Posts: 4568
9
  • Likes 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that when you extend HttpServlet you need to override one of the doXXX methods (doPost, doGet etc). You don't need to override all of them (and you usually won't). Which means they can't be marked as abstract - if they were, you'd be forced to implement them all. But an unmodified HttpServlet is pretty useless, so it's worth labelling it abstract to emphasis it is not intended to be instantiated.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic