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: 2018-11-07 09:07:03 +0100 (on, 07 nov 2018) $
-
Field Summary
Fields Modifier and Type Field Description private ServletContext
context
private String
name
private Map<String,String>
parameters
private Class<? extends Servlet>
servletClass
-
Constructor Summary
Constructors Constructor Description ServletWrapper(Class<? extends Servlet> servletClass, String name)
-
Method Summary
Modifier and Type Method Description String
getInitParameter(String name)
Enumeration<String>
getInitParameterNames()
ServletContext
getServletContext()
String
getServletName()
void
service(HttpServletRequest request, HttpServletResponse response)
Service a request to the wrapped servlet.(package private) void
setParameter(String name, String value)
Set the value of a servlet parameter.(package private) void
setServletContext(ServletContext context)
Set the servlet context from the web application.
-
Field Details
-
servletClass
-
name
-
context
-
parameters
-
-
Constructor Details
-
ServletWrapper
-
-
Method Details
-
service
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOExceptionService 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
Set the value of a servlet parameter.- Parameters:
name
- The name of the parametervalue
- The value of the parameter
-
setServletContext
Set the servlet context from the web application. -
getInitParameter
- Specified by:
getInitParameter
in interfaceServletConfig
-
getInitParameterNames
- Specified by:
getInitParameterNames
in interfaceServletConfig
-
getServletContext
- Specified by:
getServletContext
in interfaceServletConfig
-
getServletName
- Specified by:
getServletName
in interfaceServletConfig
-