• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why HttpServlet class is abstract

 
Sanjay pts
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for GenericServlet we have abstract service() method so we can call GenericServlet as abstract class.
But why HttpServlet is abstract class .
Please update me.
Thanx
sanjay
 
osman cinar eren
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess it is something like a marker abstractness(if there is a word like this ).
It tells us that implement one of the doXXX() methods.
 
Sanjay pts
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are right

b'se when i write class with


public class Myclass extends HttpServlet {
}

and i tries to compile it will not give me an error.
So it means if it was abstract class then it will not compile.
So u r right.

Thanx
sanjay
 
sergio mendez-rueda
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
HttpServlet is abstract class because is a *stub* -
a class that implements the pertinent interfaces
with methods that do NOTHING-.
Developers can subclasse the stub, overriding only
those methods that are important to their application.
<!-- After E Gamma an Adapter (Design patterns??) -->
This construct is fine, because it makes easy to create a subclass
(your class) that reacts to *only* the relevant events that are
important to your application.
gruesse,
ser
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic