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 toServlet.init(ServletConfig)
,Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
andServlet.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
All Methods Instance Methods Concrete Methods 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.
-
-
-
Method Detail
-
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 interfaceServletConfig
-
getInitParameterNames
public Enumeration<String> getInitParameterNames()
- Specified by:
getInitParameterNames
in interfaceServletConfig
-
getServletContext
public ServletContext getServletContext()
- Specified by:
getServletContext
in interfaceServletConfig
-
getServletName
public String getServletName()
- Specified by:
getServletName
in interfaceServletConfig
-
-