org.apache.commons.cactus.server
Class ServletConfigWrapper

java.lang.Object
  |
  +--org.apache.commons.cactus.server.ServletConfigWrapper
All Implemented Interfaces:
javax.servlet.ServletConfig

public class ServletConfigWrapper
extends java.lang.Object
implements javax.servlet.ServletConfig

Wrapper around ServletConfig which overrides the getServletContext() method to return our own wrapper around ServletContext.

Version:
1.1
See Also:
ServletContext

Constructor Summary
ServletConfigWrapper(javax.servlet.ServletConfig theOriginalConfig)
           
 
Method Summary
 java.lang.String getInitParameter(java.lang.String theName)
           
 java.util.Enumeration getInitParameterNames()
           
 javax.servlet.ServletContext getServletContext()
           
 java.lang.String getServletName()
           
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletConfigWrapper

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

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

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

getServletContext

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

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.

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.


Copyright © 2000-2001 Apache Software Foundation. All Rights Reserved.