Name
GenericServlet
Synopsis
Class Name: javax.servlet.GenericServlet
Superclass: java.lang.Object
Immediate Subclasses:
javax.servlet.http.HttpServlet
Interfaces Implemented: javax.servlet.Servlet,
javax.servlet.ServletConfig,
java.io.Serializable
Availability: Servlet API 1.0 and later
Description
GenericServlet
provides a basic implementation of the
Servlet interface for protocol-independent
servlets. As a convenience, it also implements the
ServletConfig interface. Most servlet developers
subclass this class or HttpServlet, rather than
implement the Servlet interface directly.
GenericServlet includes basic versions of the
init( ) and destroy( ) methods,
which perform basic setup and cleanup tasks, such as managing the
server’s ServletConfig object. It’s
good form for a servlet that overrides one of these methods to call
the superclass version of the method.
GenericServlet also includes log( ) methods that provide easy access to the logging functions
from ServletContext.
The service( ) method is declared as abstract and
must be overridden. Well-written servlets also override
getServletInfo( ).
Class Summary
public abstract class GenericServlet implements Servlet, ServletConfig, java.io.Serializable { // Constructors public GenericServlet(); // Instance Methods public void destroy(); public String getInitParameter(String name); public Enumeration getInitParameterNames(); public ServletConfig getServletConfig(); public ServletContext getServletContext(); public String getServletInfo(); ...