2.17.2: 2011-06-17

net.sf.basedb.clients.web.extensions
Class ServletWrapper

java.lang.Object
  extended by 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) $

Field Summary
private  ServletContext context
           
private  String name
           
private  Map<String,String> parameters
           
private  Class<? extends Servlet> servletClass
           
 
Constructor Summary
ServletWrapper(Class<? extends Servlet> servletClass, String name)
           
 
Method Summary
 String getInitParameter(String name)
           
 Enumeration 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servletClass

private final Class<? extends Servlet> servletClass

name

private final String name

context

private ServletContext context

parameters

private final Map<String,String> parameters
Constructor Detail

ServletWrapper

public ServletWrapper(Class<? extends Servlet> servletClass,
                      String name)
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 parameters
response - 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 parameter
value - 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

2.17.2: 2011-06-17