javax.servlet.http.HttpServlet instead.
GenericServlet implements the Servlet
and ServletConfig interfaces. GenericServlet
may be directly extended by a servlet, although it's more common to extend
a protocol-specific subclass such as HttpServlet.
GenericServlet makes writing servlets
easier. It provides simple versions of the lifecycle methods
init and destroy and of the methods
in the ServletConfig interface. GenericServlet
also implements the log method, declared in the
ServletContext interface.
To write a generic servlet, you need only
override the abstract service method.
Servlet.destroy().
String containing the value of the named
initialization parameter, or null if the parameter does
not exist. See ServletConfig.getInitParameter(java.lang.String).
This method is supplied for convenience. It gets the
value of the named parameter from the servlet's
ServletConfig object.
name a String specifying the name
of the initialization parameterString containing the value
of the initalization parameterEnumeration of String objects,
or an empty Enumeration if the servlet has no
initialization parameters. See ServletConfig.getInitParameterNames().
This method is supplied for convenience. It gets the
parameter names from the servlet's ServletConfig object.
String
objects containing the names of
the servlet's initialization parametersServletConfig object.
ServletConfig object
that initialized this servletServletContext in which this servlet
is running. See ServletConfig.getServletContext().
This method is supplied for convenience. It gets the
context from the servlet's ServletConfig object.
ServletContext object
passed to this servlet by the init
methodServlet.getServletInfo().
Servlet.init(javax.servlet.ServletConfig).
This implementation stores the
object it receives from the servlet container for alter use.
When overriding this form of the method, call
ServletConfigsuper.init(config).
config the ServletConfig object
that contains configutation
information for this servletServletException if an exception occurs that
interrupts the servlet's normal
operationUnavailableExceptionsuper.init(config).
Instead of overriding , simply override
this method and it will be called by
init(javax.servlet.ServletConfig)GenericServlet.init(ServletConfig config).
The ServletConfig object can still be retrieved via .
getServletConfig()
ServletException if an exception occurs that
interrupts the servlet's
normal operationServletContext.log(java.lang.String).
msg a String specifying
the message to be written to the log fileThrowable exception
to the servlet log file, prepended by the servlet's name.
See ServletContext.log(java.lang.String,java.lang.Throwable).
message a String that describes
the error or exceptiont the java.lang.Throwable error
or exceptionServlet.service(javax.servlet.ServletRequest,javax.servlet.ServletResponse).
This method is declared abstract so subclasses, such as
HttpServlet, must override it.
req the ServletRequest object
that contains the client's requestres the ServletResponse object
that will contain the servlet's responseServletException if an exception occurs that
interferes with the servlet's
normal operation occurredjava.io.IOException if an input or output
exception occursServletConfig.getServletName().