GenericServlet vs HttpServlet
1 posts in topic
Flat View  Flat View

Posted By:   kalpana_v
Posted On:   Sunday, June 24, 2007 12:52 PM

Why do we go for GenericServlet and when do we go for HttpServlet?As far as I know ,HttpServlet is used if the protocal is HTTP,are there any other reasons to select among them?

Re: GenericServlet vs HttpServlet

Posted By:   Anonymous  
Posted On:   Monday, June 25, 2007 04:41 AM

A Servlet in genereral , is an instance of a class which implements the javax.servlet.Servlet interface. Most Servlets, extend one of the standard implementations of that interface. GenericServlet implements the Servlet and ServletConfig interfaces.GenericServlet may be directly extended by a servlet.

public abstract class GenericServlet
extends java.lang.Object
implements Servlet, ServletConfig, java.io.Serializable

HttpServlet is a subclass of GenericServlet

public abstract class HttpServlet extends GenericServlet
implements java.io.Serializable

As you see the term Generic and Http, Generic servlet is not protocol specific, it works for all protocols. But HttpServlet is specifically used for handling HTTP requests



"Open your mind"

About | Sitemap | Contact