net.sf.basedb.clients.web.extensions
Class ServletWrapper
java.lang.Object
net.sf.basedb.clients.web.extensions.ServletWrapper
- All Implemented Interfaces:
- ServletConfig
public class ServletWrapper
- extends Object
- implements ServletConfig
A wrapper class for servlets defined by extensions. This wrapper holds
initialisation parameters and the servlet context that a servlet
needs. Each request to a servlet will create a new instance of the
servlet, followed by calls to Servlet.init(ServletConfig)
,
Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
and Servlet.destroy()
.
- Version:
- 2.7
- Author:
- nicklas
- Last modified
- $Date: 2008-09-11 22:05:50 +0200 (Thu, 11 Sep 2008) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
servletClass
private final Class<? extends Servlet> servletClass
name
private final String name
context
private ServletContext context
parameters
private final Map<String,String> parameters
ServletWrapper
public ServletWrapper(Class<? extends Servlet> servletClass,
String name)
service
public void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
- Service a request to the wrapped servlet. A new servlet instance
is created for each request.
- Parameters:
request
- The request parametersresponse
- The response object
- Throws:
ServletException
IOException
setParameter
void setParameter(String name,
String value)
- Set the value of a servlet parameter.
- Parameters:
name
- The name of the parametervalue
- The value of the parameter
setServletContext
void setServletContext(ServletContext context)
- Set the servlet context from the web application.
getInitParameter
public String getInitParameter(String name)
- Specified by:
getInitParameter
in interface ServletConfig
getInitParameterNames
public Enumeration getInitParameterNames()
- Specified by:
getInitParameterNames
in interface ServletConfig
getServletContext
public ServletContext getServletContext()
- Specified by:
getServletContext
in interface ServletConfig
getServletName
public String getServletName()
- Specified by:
getServletName
in interface ServletConfig