|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.servlet.GenericServlet
public abstract class GenericServlet
Abstract base class for all servlets.
| Constructor Summary | |
|---|---|
GenericServlet()
Does nothing. |
|
| Method Summary | |
|---|---|
void |
destroy()
Called by the server when it no longer needs the servlet. |
java.lang.String |
getInitParameter(java.lang.String name)
Gets a servlet's initialization parameter |
java.util.Enumeration |
getInitParameterNames()
Gets all the initialization parameters |
ServletConfig |
getServletConfig()
Gets the servlet servletConfig class |
ServletContext |
getServletContext()
Returns the servlets context |
java.lang.String |
getServletInfo()
The servlet programmer can put other additional info (version number, etc) here. |
java.lang.String |
getServletName()
Gets you the name of this servlet's instance. |
void |
init()
Automatically called by init(ServletConfig servletConfig). |
void |
init(ServletConfig servletConfig)
Initializes the servlet. |
void |
log(java.lang.String message)
Writes the class name and a message to the log. |
void |
log(java.lang.String message,
java.lang.Throwable th)
Writes the class name, a message and a stack trace to the log. |
abstract void |
service(ServletRequest request,
ServletResponse response)
Called by the server every time it wants the servlet to handle a request. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GenericServlet()
| Method Detail |
|---|
public void init(ServletConfig servletConfig)
throws ServletException
This version saves the ServletConfig and calls init().
This means that a servlet can just override init().
Note that if a servlet overrides this method it should call
super.init(servletConfig) otherwise the other methods in
GenericServlet are not garanteed to work.
init in interface ServletservletConfig - This servlet configuration class
ServletException - If an error occursUnavailableException
public void init()
throws ServletException
init(ServletConfig servletConfig).
This version does nothing.
ServletException - If an error occurspublic ServletContext getServletContext()
getServletContext in interface ServletConfigpublic java.lang.String getInitParameter(java.lang.String name)
getInitParameter in interface ServletConfigname - the name of the wanted parameter
public java.util.Enumeration getInitParameterNames()
getInitParameterNames in interface ServletConfigpublic void log(java.lang.String message)
getServletContext().log().
message - the message to write
public void log(java.lang.String message,
java.lang.Throwable th)
getServletContext().log().
message - the message to writeth - the object that was thrown to cause this logpublic java.lang.String getServletInfo()
The Servlet 2.1 Spec says that this should return an empty string. The Servlet 2.1 API says that this should return null unless overridden. This version returns the servlet's class name which seems more usefull.
getServletInfo in interface Servletpublic ServletConfig getServletConfig()
getServletConfig in interface Servlet
public abstract void service(ServletRequest request,
ServletResponse response)
throws ServletException,
java.io.IOException
service in interface Servletrequest - all the request informationresponse - class to write all the response data to
ServletException - If an error occurs
java.io.IOException - If an error occursSingleThreadModelpublic void destroy()
This version does nothing because it has nothing to clean up.
Note that the the 2.1 Spec says that this should do nothing, but the 2.1 API Doc says that it logs the destroy action.
destroy in interface Servletpublic java.lang.String getServletName()
getServletName in interface ServletConfig
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||