aspose file tools
The moose likes Servlets and the fly likes GenericServlet is abstract? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "GenericServlet is abstract?" Watch "GenericServlet is abstract?" New topic
Author

GenericServlet is abstract?

ritesh srivastav
Greenhorn

Joined: Nov 30, 2012
Posts: 8
why GenricServlet decleared abstract?
Greg Charles
Bartender

Joined: Oct 01, 2001
Posts: 2536
    
  10

Well, what does abstract mean? GenericServlet and its child HttpServlet are meant to provide a framework for the concrete servlets that you write to do something interesting. They're not meant to be instantiated themselves, and if you could instantiate one of them, it wouldn't do anything for you.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56180
    
  13

Here's a better question you should answer: why should it not be abstract?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
devasis majhi
Greenhorn

Joined: Dec 29, 2012
Posts: 9
I think this the way Servlet API has been designed to force the developer to implement the service() of GenricServlet to process client request or response. If it would have not been an abstract class I don't see any harm in it. Those who want to customize their service method they could have overridden it and do what they want to do.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35237
    
    7
See https://www.coderanch.com/how-to/java/ServletsFaq#overriding-service for why overriding the service method is generally not what you should do, and https://www.coderanch.com/how-to/java/ServletsFaq#otherProtocols for why GenericServlet and HttpServlet exist as separate classes to begin with.


Android appsImageJ pluginsJava web charts
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: GenericServlet is abstract?