This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why HTTPServlet class is abstract?

 
Vaibhav G Garg
Ranch Hand
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • 1
  • Mark post as helpful
  • send pies
  • 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.

 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 4
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic