This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Servlets and the fly likes GenericServlet is abstract? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "GenericServlet is abstract?" Watch "GenericServlet is abstract?" New topic

GenericServlet is abstract?

ritesh srivastav

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

Joined: Oct 01, 2001
Posts: 2774

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

Joined: Jan 10, 2002
Posts: 60082

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

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
devasis majhi

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

Joined: Mar 22, 2005
Posts: 39578
See for why overriding the service method is generally not what you should do, and for why GenericServlet and HttpServlet exist as separate classes to begin with.

Ping & DNS - updated with new look and Ping home screen widget
I agree. Here's the link:
subject: GenericServlet is abstract?
Similar Threads
CS/Engineering Terminology and Compromises in Modeling
Reg. native methods
Tech Word Game
WA #1.....word association