java.lang.Object
javax.servlet.GenericServlet
- All Implemented Interfaces:
java.io.Serializable
,Servlet
,ServletConfig
- Direct Known Subclasses:
HttpServlet
public abstract class GenericServlet extends java.lang.Object implements Servlet, ServletConfig, java.io.Serializable
The GenericServlet API.
- Author:
- Manfred Riem ([email protected])
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description GenericServlet()
Constructor. -
Method Summary
Modifier and Type Method Description void
destroy()
Destroy the servlet.java.lang.String
getInitParameter(java.lang.String name)
Get the init parameter.java.util.Enumeration<java.lang.String>
getInitParameterNames()
Get the init parameter names.ServletConfig
getServletConfig()
Get the servlet config.ServletContext
getServletContext()
Get the servlet context.java.lang.String
getServletInfo()
Get the servlet info.java.lang.String
getServletName()
Get the servlet name.void
init()
Init the servlet.void
init(ServletConfig config)
Called by the servlet container to indicate to a servlet that the servlet is being placed into service.void
log(java.lang.String message)
Log the message.void
log(java.lang.String message, java.lang.Throwable throwable)
Log the message.abstract void
service(ServletRequest request, ServletResponse response)
Process the request.
-
Constructor Details
-
GenericServlet
public GenericServlet()Constructor.
-
-
Method Details
-
destroy
public void destroy()Destroy the servlet. -
getInitParameter
public java.lang.String getInitParameter(java.lang.String name)Get the init parameter.- Specified by:
getInitParameter
in interfaceServletConfig
- Parameters:
name
- the name.- Returns:
- the value, or null.
-
getInitParameterNames
public java.util.Enumeration<java.lang.String> getInitParameterNames()Get the init parameter names.- Specified by:
getInitParameterNames
in interfaceServletConfig
- Returns:
- the init parameter names.
-
getServletConfig
Get the servlet config.- Specified by:
getServletConfig
in interfaceServlet
- Returns:
- the servlet config.
-
getServletContext
Get the servlet context.- Specified by:
getServletContext
in interfaceServletConfig
- Returns:
- the servlet context.
-
getServletInfo
public java.lang.String getServletInfo()Get the servlet info.- Specified by:
getServletInfo
in interfaceServlet
- Returns:
- ""
-
getServletName
public java.lang.String getServletName()Get the servlet name.- Specified by:
getServletName
in interfaceServletConfig
- Returns:
- the servlet name.
-
init
Called by the servlet container to indicate to a servlet that the servlet is being placed into service. SeeServlet.init(javax.servlet.ServletConfig)
.This implementation stores the
ServletConfig
object it receives from the servlet container for later use. When overriding this form of the method, callsuper.init(config)
.- Specified by:
init
in interfaceServlet
- Parameters:
config
- theServletConfig
object that contains configuration information for this servlet- Throws:
ServletException
- if an exception occurs that interrupts the servlet's normal operation- See Also:
UnavailableException
-
init
Init the servlet.- Throws:
ServletException
- when a servlet error occurs.
-
log
public void log(java.lang.String message)Log the message.- Parameters:
message
- the message.
-
log
public void log(java.lang.String message, java.lang.Throwable throwable)Log the message.- Parameters:
message
- the message.throwable
- the throwable.
-
service
public abstract void service(ServletRequest request, ServletResponse response) throws ServletException, java.io.IOExceptionProcess the request.- Specified by:
service
in interfaceServlet
- Parameters:
request
- the request.response
- the response.- Throws:
java.io.IOException
- when an I/O error occurs.ServletException
- when a servlet error occurs.
-