wood burning stoves 2.0*
The moose likes Servlets and the fly likes HttpServlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpServlet" Watch "HttpServlet" New topic
Author

HttpServlet

Ajit Shanbhag
Greenhorn

Joined: Oct 15, 2008
Posts: 7
Can anyone please tell me what is the specific reason for having HttpServlet as an abstract class without any abstract methods?


Ajit Shanbhag
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41088
    
  43
Because -in order to be useful- at least one of its methods (generally doGet or doPost) needs to be overridden. Making HttpServlet abstract ensures that it can't be used directly - it needs to be subclassed in order to be instantiated.


Ping & DNS - my free Android networking tools app
Ajit Shanbhag
Greenhorn

Joined: Oct 15, 2008
Posts: 7
Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HttpServlet
 
Similar Threads
why HttpServlet is abstract?
HttpServlet class
Generic Servlet,HttpServlet
HttpServlet
Qn on HttpServlet