org.apache.cactus.server
Class AbstractServletConfigWrapper

java.lang.Object
  extended by org.apache.cactus.server.AbstractServletConfigWrapper
All Implemented Interfaces:
javax.servlet.ServletConfig
Direct Known Subclasses:
ServletConfigWrapper

public abstract class AbstractServletConfigWrapper
extends java.lang.Object
implements javax.servlet.ServletConfig

Abstract wrapper around ServletConfig which overrides the getServletContext() method to return our own wrapper around ServletContext. This class provides a common implementation of the wrapper for the different servlet API.

Version:
$Id: AbstractServletConfigWrapper.java 292559 2005-09-29 21:36:43Z kenney $

Field Summary
protected  java.util.Hashtable initParameters
          List of parameters set using the setInitParameter() method.
protected  javax.servlet.ServletConfig originalConfig
          The original servlet config object.
protected  java.lang.String servletName
          Simulated name of the servlet.
 
Constructor Summary
AbstractServletConfigWrapper(javax.servlet.ServletConfig theOriginalConfig)
           
 
Method Summary
 java.lang.String getInitParameter(java.lang.String theName)
           
 java.util.Enumeration getInitParameterNames()
           
 javax.servlet.ServletConfig getOriginalConfig()
           
 javax.servlet.ServletContext getServletContext()
           
 java.lang.String getServletName()
           
static AbstractServletConfigWrapper newInstance(javax.servlet.ServletConfig theOriginalConfig)
           
 void setInitParameter(java.lang.String theName, java.lang.String theValue)
          Sets a parameter as if it were set in the web.xml file.
 void setServletName(java.lang.String theServletName)
          Sets the servlet name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

originalConfig

protected javax.servlet.ServletConfig originalConfig
The original servlet config object.


initParameters

protected java.util.Hashtable initParameters
List of parameters set using the setInitParameter() method.


servletName

protected java.lang.String servletName
Simulated name of the servlet.

Constructor Detail

AbstractServletConfigWrapper

public AbstractServletConfigWrapper(javax.servlet.ServletConfig theOriginalConfig)
Parameters:
theOriginalConfig - the original servlet config object
Method Detail

newInstance

public static AbstractServletConfigWrapper newInstance(javax.servlet.ServletConfig theOriginalConfig)
Parameters:
theOriginalConfig - object
Returns:
AbstractServletConfigWrapper

setInitParameter

public void setInitParameter(java.lang.String theName,
                             java.lang.String theValue)
Sets a parameter as if it were set in the web.xml file.

Parameters:
theName - the parameter's name
theValue - the parameter's value

setServletName

public void setServletName(java.lang.String theServletName)
Sets the servlet name. That will be the value returned by the getServletName() method.

Parameters:
theServletName - the servlet's name

getOriginalConfig

public javax.servlet.ServletConfig getOriginalConfig()
Returns:
the original unmodified config object
Since:
1.5

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface javax.servlet.ServletConfig
Returns:
our own wrapped servlet context object

getInitParameter

public java.lang.String getInitParameter(java.lang.String theName)
Specified by:
getInitParameter in interface javax.servlet.ServletConfig
Parameters:
theName - the name of the parameter's value to return
Returns:
the value of the parameter, looking for it first in the list of parameters set using the setInitParameter() method and then in those set in web.xml.

getInitParameterNames

public java.util.Enumeration getInitParameterNames()
Specified by:
getInitParameterNames in interface javax.servlet.ServletConfig
Returns:
the union of the parameters defined in the Redirector web.xml file and the one set using the setInitParameter() method.

getServletName

public java.lang.String getServletName()
Specified by:
getServletName in interface javax.servlet.ServletConfig
Returns:
the simulated servlet's name if defined or the redirector servlet's name


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.