org.apache.catalina.core
Class StandardWrapper

java.lang.Object
  extended by org.apache.catalina.core.ContainerBase
      extended by org.apache.catalina.core.StandardWrapper
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, javax.servlet.ServletConfig, Container, Lifecycle, Pipeline, Wrapper
Direct Known Subclasses:
Tomcat.ExistingStandardWrapper

public class StandardWrapper
extends ContainerBase
implements javax.servlet.ServletConfig, Wrapper, javax.management.NotificationEmitter

Standard implementation of the Wrapper interface that represents an individual servlet definition. No child Containers are allowed, and the parent Container must be a Context.

Version:
$Revision: 1333 $ $Date: 2009-12-12 15:56:28 +0100 (Sat, 12 Dec 2009) $
Author:
Craig R. McClanahan, Remy Maucherat

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.catalina.core.ContainerBase
ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild
 
Field Summary
protected  boolean asyncSupported
          Async supported flag.
protected  long available
          The date and time at which this servlet will become available (in milliseconds since the epoch), or zero if the servlet is available.
protected  javax.management.NotificationBroadcasterSupport broadcaster
          The broadcaster that sends j2ee notifications.
protected  int classLoadTime
           
protected static java.lang.Class[] classType
          Static class array used when the SecurityManager is turned on and Servlet.init is invoked.
protected static java.lang.Class[] classTypeUsedInService
          Static class array used when the SecurityManager is turned on and Servlet.service is invoked.
protected  int countAllocated
          The count of allocations that are currently active for STM servlets.
protected static java.lang.String[] DEFAULT_SERVLET_METHODS
           
protected  java.lang.String description
          Description.
protected  boolean dynamic
          Dynamic flag.
protected  boolean enabled
          Enabled flag.
protected  StandardWrapperFacade facade
          The facade associated with this wrapper.
protected static java.lang.String info
          The descriptive information string for this implementation.
protected  javax.servlet.Servlet instance
          The (single) initialized instance of this servlet.
protected  java.util.Stack instancePool
          Stack containing the STM instances.
protected  InstanceSupport instanceSupport
          The support object for our instance listeners.
protected  boolean isJspServlet
          True if this StandardWrapper is for the JspServlet
protected  java.lang.String jspFile
          The context-relative URI of the JSP file for this servlet.
protected  javax.management.ObjectName jspMonitorON
          The ObjectName of the JSP monitoring mbean
protected  int loadOnStartup
          The load-on-startup order value (negative value means load on first call) for this servlet.
protected  long loadTime
           
protected static org.jboss.logging.Logger log
           
protected  java.util.ArrayList mappings
          Mappings associated with the wrapper.
protected  int maxInstances
          Maximum number of STM instances.
protected  Multipart multipartConfig
          The multipart config annotation configured on this servlet.
protected  int nInstances
          Number of instances currently loaded for a STM servlet.
protected  javax.management.MBeanNotificationInfo[] notificationInfo
           
protected  java.util.HashMap parameters
          The initialization parameters for this servlet, keyed by parameter name.
protected  java.util.HashMap references
          The security role references for this servlet, keyed by role name used in the servlet.
protected  java.lang.String runAs
          The run-as identity for this servlet.
protected  long sequenceNumber
          The notification sequence number.
protected  java.lang.String servletClass
          The fully qualified servlet class name for this servlet.
protected  javax.servlet.Servlet servletInstance
          The (single) initialized instance of this servlet.
protected  javax.servlet.ServletSecurityElement servletSecurity
          Associated ServletSecurity.
protected  boolean singleThreadModel
          Does this servlet implement the SingleThreadModel interface?
protected  boolean swallowOutput
          Should we swallow System.out
protected  org.apache.catalina.core.StandardWrapperValve swValve
           
protected  long unloadDelay
          Wait time for servlet unload in ms.
protected  boolean unloading
          Are we unloading our servlet instance at the moment?
 
Fields inherited from class org.apache.catalina.core.ContainerBase
backgroundProcessorDelay, children, cluster, CONTAINER_ARRAY, controller, domain, initialized, jarRepository, lifecycle, LISTENER_ARRAY, listeners, loader, logger, logName, manager, mserver, name, oname, parent, parentClassLoader, pipeline, realm, resources, sm, startChildren, started, suffix, support, type
 
Fields inherited from interface org.apache.catalina.Container
ADD_CHILD_EVENT, ADD_MAPPER_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_MAPPER_EVENT, REMOVE_VALVE_EVENT
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
StandardWrapper()
          Create a new StandardWrapper component with the default basic Valve.
 
Method Summary
 void addChild(Container child)
          Refuse to add a child Container, because Wrappers are the lowest level of the Container hierarchy.
protected  void addDefaultMapper(java.lang.String mapperClass)
          Add a default Mapper implementation if none have been configured explicitly.
 void addInitParameter(java.lang.String name, java.lang.String value)
          Add a new servlet initialization parameter for this servlet.
 void addInstanceListener(InstanceListener listener)
          Add a new listener interested in InstanceEvents.
 void addMapping(java.lang.String mapping)
          Add a mapping associated with the Wrapper.
 void addNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object object)
           
 void addSecurityReference(java.lang.String name, java.lang.String link)
          Add a new security role reference record to the set of records for this servlet.
 javax.servlet.Servlet allocate()
          Allocate an initialized instance of this Servlet that is ready to have its service() method called.
 void backgroundProcess()
          Execute a periodic task, such as reloading, etc.
 void deallocate(javax.servlet.Servlet servlet)
          Return this previously allocated servlet to the pool of available instances.
 java.lang.String findInitParameter(java.lang.String name)
          Return the value for the specified initialization parameter name, if any; otherwise return null.
 java.lang.String[] findInitParameters()
          Return the names of all defined initialization parameters for this servlet.
 Wrapper findMappingObject()
          FIXME: Fooling introspection ...
 java.lang.String[] findMappings()
          Return the mappings associated with this wrapper.
 java.lang.String findSecurityReference(java.lang.String name)
          Return the security role link for the specified security role reference name, if any; otherwise return null.
 java.lang.String[] findSecurityReferences()
          Return the set of security role reference names associated with this servlet, if any; otherwise return a zero-length array.
protected  java.lang.reflect.Method[] getAllDeclaredMethods(java.lang.Class c)
           
 boolean getAsyncSupported()
          Return the async supported value.
 long getAvailable()
          Return the available date/time for this servlet, in milliseconds since the epoch.
 int getClassLoadTime()
           
 int getCountAllocated()
          Return the number of active allocations of this servlet.
 java.lang.String getDescription()
          Return the Servlet description.
 boolean getEnabled()
          Return the enabled value.
 java.lang.String getEngineName()
           
 int getErrorCount()
           
 javax.servlet.ServletRegistration getFacade()
          Get the facade ServletRegistration.
 java.lang.String getInfo()
          Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.
 java.lang.String getInitParameter(java.lang.String name)
          Return the initialization parameter value for the specified name, if any; otherwise return null.
 java.util.Enumeration getInitParameterNames()
          Return the set of initialization parameter names defined for this servlet.
 InstanceSupport getInstanceSupport()
          Return the InstanceSupport object for this Wrapper instance.
 java.lang.String getJspFile()
          Return the context-relative URI of the JSP file for this servlet.
 int getLoadOnStartup()
          Return the load-on-startup order value (negative value means load on first call).
 java.lang.String getLoadOnStartupString()
           
 long getLoadTime()
           
 int getMaxInstances()
          Return maximum number of instances that will be allocated when a single thread model servlet is used.
 long getMaxTime()
           
 long getMinTime()
           
 Multipart getMultipartConfig()
          Multipart configuration for this Servlet.
 javax.management.MBeanNotificationInfo[] getNotificationInfo()
           
 long getProcessingTime()
           
 int getRequestCount()
           
static java.lang.Throwable getRootCause(javax.servlet.ServletException e)
          Extract the root cause from a servlet exception.
 java.lang.String getRunAs()
          Return the run-as identity for this servlet.
 javax.servlet.Servlet getServlet()
          Return the associated servlet instance.
 java.lang.String getServletClass()
          Return the fully qualified servlet class name for this servlet.
 javax.servlet.ServletContext getServletContext()
          Return the servlet context with which this servlet is associated.
 java.lang.String[] getServletMethods()
          Gets the names of the methods supported by the underlying servlet.
 java.lang.String getServletName()
          Return the name of this servlet.
 javax.servlet.ServletSecurityElement getServletSecurity()
          Get an associated ServletSecurity, if any.
 void incrementErrorCount()
          Increment the error count used for monitoring.
protected  boolean isContainerProvidedServlet(java.lang.String classname)
          Return true if the specified class name represents a container provided servlet class that should be loaded by the server class loader.
 boolean isDynamic()
          Get the flag that indicates if the wrapper was added programmatically.
 boolean isEventProvider()
           
 boolean isSingleThreadModel()
          Return true if the servlet class represented by this component implements the SingleThreadModel interface.
 boolean isStateManageable()
           
 boolean isStatisticsProvider()
           
 boolean isUnavailable()
          Is this servlet currently unavailable?
 void load()
          Load and initialize an instance of this servlet, if there is not already at least one initialized instance.
 javax.servlet.Servlet loadServlet()
          Load and initialize an instance of this servlet, if there is not already at least one initialized instance.
protected  void registerJMX(StandardContext ctx)
           
 void removeInitParameter(java.lang.String name)
          Remove the specified initialization parameter from this servlet.
 void removeInstanceListener(InstanceListener listener)
          Remove a listener no longer interested in InstanceEvents.
 void removeMapping(java.lang.String mapping)
          Remove a mapping associated with the wrapper.
 void removeNotificationListener(javax.management.NotificationListener listener)
          Remove a JMX-NotificationListener
 void removeNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object object)
           
 void removeSecurityReference(java.lang.String name)
          Remove any security role reference for the specified role name.
 void setAsyncSupported(boolean value)
          Set the async supported value.
 void setAvailable(long available)
          Set the available date/time for this servlet, in milliseconds since the epoch.
 void setDescription(java.lang.String description)
          Set the description.
 void setDynamic(boolean dynamic)
          Set a flag that indicates if the wrapper was added programmatically.
 void setEnabled(boolean value)
          Set the enabled value.
 void setErrorCount(int errorCount)
           
 void setJspFile(java.lang.String jspFile)
          Set the context-relative URI of the JSP file for this servlet.
 void setLoadOnStartup(int value)
          Set the load-on-startup order value (negative value means load on first call).
 void setLoadOnStartupString(java.lang.String value)
          Set the load-on-startup order value from a (possibly null) string.
 void setLoadTime(long loadTime)
           
 void setMaxInstances(int maxInstances)
          Set the maximum number of instances that will be allocated when a single thread model servlet is used.
 void setMaxTime(long maxTime)
           
 void setMinTime(long minTime)
           
 void setMultipartConfig(Multipart multipartConfig)
          Set the multipart configuration for this Servlet.
 void setParent(Container container)
          Set the parent Container of this Wrapper, but only if it is a Context.
 void setProcessingTime(long processingTime)
           
 void setRequestCount(int requestCount)
           
 void setRunAs(java.lang.String runAs)
          Set the run-as identity for this servlet.
 void setServlet(javax.servlet.Servlet servlet)
          Set the associated servlet instance.
 void setServletClass(java.lang.String servletClass)
          Set the fully qualified servlet class name for this servlet.
 void setServletName(java.lang.String name)
          Set the name of this servlet.
 java.util.Set<java.lang.String> setServletSecurity(javax.servlet.ServletSecurityElement servletSecurity)
          Set an associated ServletSecurity on mappings which are currently associated with the Servlet.
 void start()
          Start this component, pre-loading the servlet if the load-on-startup value is set appropriately.
 void stop()
          Stop this component, gracefully shutting down the servlet if it has been initialized.
 java.lang.String toString()
          Return a String representation of this component.
 void unavailable(javax.servlet.UnavailableException unavailable)
          Process an UnavailableException, marking this servlet as unavailable for the specified amount of time.
 void unload()
          Unload all initialized instances of this servlet, after calling the destroy() method for each instance.
 
Methods inherited from class org.apache.catalina.core.ContainerBase
addContainerListener, addLifecycleListener, addPropertyChangeListener, addValve, createObjectName, destroy, findChild, findChildren, findContainerListeners, findLifecycleListeners, fireContainerEvent, getBackgroundProcessorDelay, getBasic, getChildren, getCluster, getContainerSuffix, getDomain, getFirst, getJarRepository, getJmxName, getJSR77Suffix, getLoader, getLogger, getManager, getMappingObject, getName, getObjectName, getParent, getParentClassLoader, getParentName, getPipeline, getRealm, getResources, getStartChildren, getType, getValveObjectNames, getValves, init, invoke, isStarted, logName, postDeregister, postRegister, preDeregister, preRegister, removeChild, removeContainerListener, removeLifecycleListener, removePropertyChangeListener, removeValve, setBackgroundProcessorDelay, setBasic, setCluster, setDomain, setJarRepository, setLoader, setManager, setName, setParentClassLoader, setRealm, setResources, setStartChildren, threadStart, threadStop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Container
addContainerListener, addPropertyChangeListener, findChild, findChildren, findContainerListeners, fireContainerEvent, getBackgroundProcessorDelay, getCluster, getJarRepository, getLoader, getLogger, getManager, getMappingObject, getName, getObjectName, getParent, getParentClassLoader, getPipeline, getRealm, getResources, invoke, isStarted, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setJarRepository, setLoader, setManager, setName, setParentClassLoader, setRealm, setResources
 

Field Detail

log

protected static org.jboss.logging.Logger log

DEFAULT_SERVLET_METHODS

protected static final java.lang.String[] DEFAULT_SERVLET_METHODS

asyncSupported

protected boolean asyncSupported
Async supported flag.


dynamic

protected boolean dynamic
Dynamic flag.


enabled

protected boolean enabled
Enabled flag.


available

protected long available
The date and time at which this servlet will become available (in milliseconds since the epoch), or zero if the servlet is available. If this value equals Long.MAX_VALUE, the unavailability of this servlet is considered permanent.


broadcaster

protected javax.management.NotificationBroadcasterSupport broadcaster
The broadcaster that sends j2ee notifications.


countAllocated

protected int countAllocated
The count of allocations that are currently active for STM servlets.


description

protected java.lang.String description
Description.


facade

protected StandardWrapperFacade facade
The facade associated with this wrapper.


info

protected static final java.lang.String info
The descriptive information string for this implementation.

See Also:
Constant Field Values

instance

protected javax.servlet.Servlet instance
The (single) initialized instance of this servlet.


servletInstance

protected javax.servlet.Servlet servletInstance
The (single) initialized instance of this servlet.


instanceSupport

protected InstanceSupport instanceSupport
The support object for our instance listeners.


jspFile

protected java.lang.String jspFile
The context-relative URI of the JSP file for this servlet.


loadOnStartup

protected int loadOnStartup
The load-on-startup order value (negative value means load on first call) for this servlet.


multipartConfig

protected Multipart multipartConfig
The multipart config annotation configured on this servlet.


mappings

protected java.util.ArrayList mappings
Mappings associated with the wrapper.


parameters

protected java.util.HashMap parameters
The initialization parameters for this servlet, keyed by parameter name.


references

protected java.util.HashMap references
The security role references for this servlet, keyed by role name used in the servlet. The corresponding value is the role name of the web application itself.


runAs

protected java.lang.String runAs
The run-as identity for this servlet.


servletSecurity

protected javax.servlet.ServletSecurityElement servletSecurity
Associated ServletSecurity.


sequenceNumber

protected long sequenceNumber
The notification sequence number.


servletClass

protected java.lang.String servletClass
The fully qualified servlet class name for this servlet.


singleThreadModel

protected boolean singleThreadModel
Does this servlet implement the SingleThreadModel interface?


unloading

protected boolean unloading
Are we unloading our servlet instance at the moment?


maxInstances

protected int maxInstances
Maximum number of STM instances.


nInstances

protected int nInstances
Number of instances currently loaded for a STM servlet.


instancePool

protected java.util.Stack instancePool
Stack containing the STM instances.


unloadDelay

protected long unloadDelay
Wait time for servlet unload in ms.


isJspServlet

protected boolean isJspServlet
True if this StandardWrapper is for the JspServlet


jspMonitorON

protected javax.management.ObjectName jspMonitorON
The ObjectName of the JSP monitoring mbean


swallowOutput

protected boolean swallowOutput
Should we swallow System.out


swValve

protected org.apache.catalina.core.StandardWrapperValve swValve

loadTime

protected long loadTime

classLoadTime

protected int classLoadTime

classType

protected static java.lang.Class[] classType
Static class array used when the SecurityManager is turned on and Servlet.init is invoked.


classTypeUsedInService

protected static java.lang.Class[] classTypeUsedInService
Static class array used when the SecurityManager is turned on and Servlet.service is invoked.


notificationInfo

protected javax.management.MBeanNotificationInfo[] notificationInfo
Constructor Detail

StandardWrapper

public StandardWrapper()
Create a new StandardWrapper component with the default basic Valve.

Method Detail

getAsyncSupported

public boolean getAsyncSupported()
Return the async supported value.

Specified by:
getAsyncSupported in interface Wrapper

setAsyncSupported

public void setAsyncSupported(boolean value)
Set the async supported value.

Specified by:
setAsyncSupported in interface Wrapper
Parameters:
value - New async supported value

getDescription

public java.lang.String getDescription()
Return the Servlet description.

Specified by:
getDescription in interface Wrapper

setDescription

public void setDescription(java.lang.String description)
Set the description.

Specified by:
setDescription in interface Wrapper

isDynamic

public boolean isDynamic()
Description copied from interface: Wrapper
Get the flag that indicates if the wrapper was added programmatically. The flag value defaults to false.

Specified by:
isDynamic in interface Wrapper

setDynamic

public void setDynamic(boolean dynamic)
Description copied from interface: Wrapper
Set a flag that indicates if the wrapper was added programmatically.

Specified by:
setDynamic in interface Wrapper

getEnabled

public boolean getEnabled()
Return the enabled value.

Specified by:
getEnabled in interface Wrapper

setEnabled

public void setEnabled(boolean value)
Set the enabled value.

Specified by:
setEnabled in interface Wrapper
Parameters:
value - New enabled value

getAvailable

public long getAvailable()
Return the available date/time for this servlet, in milliseconds since the epoch. If this date/time is Long.MAX_VALUE, it is considered to mean that unavailability is permanent and any request for this servlet will return an SC_NOT_FOUND error. If this date/time is in the future, any request for this servlet will return an SC_SERVICE_UNAVAILABLE error. If it is zero, the servlet is currently available.

Specified by:
getAvailable in interface Wrapper

setAvailable

public void setAvailable(long available)
Set the available date/time for this servlet, in milliseconds since the epoch. If this date/time is Long.MAX_VALUE, it is considered to mean that unavailability is permanent and any request for this servlet will return an SC_NOT_FOUND error. If this date/time is in the future, any request for this servlet will return an SC_SERVICE_UNAVAILABLE error.

Specified by:
setAvailable in interface Wrapper
Parameters:
available - The new available date/time

getCountAllocated

public int getCountAllocated()
Return the number of active allocations of this servlet.


getEngineName

public java.lang.String getEngineName()

getInfo

public java.lang.String getInfo()
Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.

Specified by:
getInfo in interface Container
Overrides:
getInfo in class ContainerBase

getInstanceSupport

public InstanceSupport getInstanceSupport()
Return the InstanceSupport object for this Wrapper instance.

Specified by:
getInstanceSupport in interface Wrapper

getJspFile

public java.lang.String getJspFile()
Return the context-relative URI of the JSP file for this servlet.

Specified by:
getJspFile in interface Wrapper

setJspFile

public void setJspFile(java.lang.String jspFile)
Set the context-relative URI of the JSP file for this servlet.

Specified by:
setJspFile in interface Wrapper
Parameters:
jspFile - JSP file URI

getLoadOnStartup

public int getLoadOnStartup()
Return the load-on-startup order value (negative value means load on first call).

Specified by:
getLoadOnStartup in interface Wrapper

setLoadOnStartup

public void setLoadOnStartup(int value)
Set the load-on-startup order value (negative value means load on first call).

Specified by:
setLoadOnStartup in interface Wrapper
Parameters:
value - New load-on-startup value

setLoadOnStartupString

public void setLoadOnStartupString(java.lang.String value)
Set the load-on-startup order value from a (possibly null) string. Per the specification, any missing or non-numeric value is converted to a zero, so that this servlet will still be loaded at startup time, but in an arbitrary order.

Parameters:
value - New load-on-startup value

getLoadOnStartupString

public java.lang.String getLoadOnStartupString()

getMultipartConfig

public Multipart getMultipartConfig()
Multipart configuration for this Servlet.

Specified by:
getMultipartConfig in interface Wrapper

setMultipartConfig

public void setMultipartConfig(Multipart multipartConfig)
Set the multipart configuration for this Servlet.

Specified by:
setMultipartConfig in interface Wrapper

getMaxInstances

public int getMaxInstances()
Return maximum number of instances that will be allocated when a single thread model servlet is used.


setMaxInstances

public void setMaxInstances(int maxInstances)
Set the maximum number of instances that will be allocated when a single thread model servlet is used.

Parameters:
maxInstances - New value of maxInstances

setParent

public void setParent(Container container)
Set the parent Container of this Wrapper, but only if it is a Context.

Specified by:
setParent in interface Container
Overrides:
setParent in class ContainerBase
Parameters:
container - Proposed parent Container

getRunAs

public java.lang.String getRunAs()
Return the run-as identity for this servlet.

Specified by:
getRunAs in interface Wrapper

setRunAs

public void setRunAs(java.lang.String runAs)
Set the run-as identity for this servlet.

Specified by:
setRunAs in interface Wrapper
Parameters:
runAs - New run-as identity value

getServletSecurity

public javax.servlet.ServletSecurityElement getServletSecurity()
Get an associated ServletSecurity, if any.

Specified by:
getServletSecurity in interface Wrapper

setServletSecurity

public java.util.Set<java.lang.String> setServletSecurity(javax.servlet.ServletSecurityElement servletSecurity)
Set an associated ServletSecurity on mappings which are currently associated with the Servlet. This will not set security on patters which are currently defined in a security constraint.

Specified by:
setServletSecurity in interface Wrapper
Returns:
the set of patterns for which the servlet security will not be defined

getServletClass

public java.lang.String getServletClass()
Return the fully qualified servlet class name for this servlet.

Specified by:
getServletClass in interface Wrapper

setServletClass

public void setServletClass(java.lang.String servletClass)
Set the fully qualified servlet class name for this servlet.

Specified by:
setServletClass in interface Wrapper
Parameters:
servletClass - Servlet class name

setServletName

public void setServletName(java.lang.String name)
Set the name of this servlet. This is an alias for the normal Container.setName() method, and complements the getServletName() method required by the ServletConfig interface.

Parameters:
name - The new name of this servlet

isSingleThreadModel

public boolean isSingleThreadModel()
Return true if the servlet class represented by this component implements the SingleThreadModel interface.


isUnavailable

public boolean isUnavailable()
Is this servlet currently unavailable?

Specified by:
isUnavailable in interface Wrapper

getFacade

public javax.servlet.ServletRegistration getFacade()
Get the facade ServletRegistration.

Specified by:
getFacade in interface Wrapper

getServletMethods

public java.lang.String[] getServletMethods()
                                     throws javax.servlet.ServletException
Gets the names of the methods supported by the underlying servlet. This is the same set of methods included in the Allow response header in response to an OPTIONS request method processed by the underlying servlet.

Specified by:
getServletMethods in interface Wrapper
Returns:
Array of names of the methods supported by the underlying servlet
Throws:
javax.servlet.ServletException

backgroundProcess

public void backgroundProcess()
Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.

Specified by:
backgroundProcess in interface Container
Overrides:
backgroundProcess in class ContainerBase

getRootCause

public static java.lang.Throwable getRootCause(javax.servlet.ServletException e)
Extract the root cause from a servlet exception.

Parameters:
e - The servlet exception

addChild

public void addChild(Container child)
Refuse to add a child Container, because Wrappers are the lowest level of the Container hierarchy.

Specified by:
addChild in interface Container
Overrides:
addChild in class ContainerBase
Parameters:
child - Child container to be added

addInitParameter

public void addInitParameter(java.lang.String name,
                             java.lang.String value)
Add a new servlet initialization parameter for this servlet.

Specified by:
addInitParameter in interface Wrapper
Parameters:
name - Name of this initialization parameter to add
value - Value of this initialization parameter to add

addInstanceListener

public void addInstanceListener(InstanceListener listener)
Add a new listener interested in InstanceEvents.

Specified by:
addInstanceListener in interface Wrapper
Parameters:
listener - The new listener

addMapping

public void addMapping(java.lang.String mapping)
Add a mapping associated with the Wrapper.

Specified by:
addMapping in interface Wrapper
Parameters:
mapping - The new wrapper mapping

addSecurityReference

public void addSecurityReference(java.lang.String name,
                                 java.lang.String link)
Add a new security role reference record to the set of records for this servlet.

Specified by:
addSecurityReference in interface Wrapper
Parameters:
name - Role name used within this servlet
link - Role name used within the web application

getServlet

public javax.servlet.Servlet getServlet()
Return the associated servlet instance.

Specified by:
getServlet in interface Wrapper

setServlet

public void setServlet(javax.servlet.Servlet servlet)
Set the associated servlet instance.

Specified by:
setServlet in interface Wrapper

allocate

public javax.servlet.Servlet allocate()
                               throws javax.servlet.ServletException
Allocate an initialized instance of this Servlet that is ready to have its service() method called. If the servlet class does not implement SingleThreadModel, the (only) initialized instance may be returned immediately. If the servlet class implements SingleThreadModel, the Wrapper implementation must ensure that this instance is not allocated again until it is deallocated by a call to deallocate().

Specified by:
allocate in interface Wrapper
Throws:
javax.servlet.ServletException - if the servlet init() method threw an exception
javax.servlet.ServletException - if a loading error occurs

deallocate

public void deallocate(javax.servlet.Servlet servlet)
                throws javax.servlet.ServletException
Return this previously allocated servlet to the pool of available instances. If this servlet class does not implement SingleThreadModel, no action is actually required.

Specified by:
deallocate in interface Wrapper
Parameters:
servlet - The servlet to be returned
Throws:
javax.servlet.ServletException - if a deallocation error occurs

findInitParameter

public java.lang.String findInitParameter(java.lang.String name)
Return the value for the specified initialization parameter name, if any; otherwise return null.

Specified by:
findInitParameter in interface Wrapper
Parameters:
name - Name of the requested initialization parameter

findInitParameters

public java.lang.String[] findInitParameters()
Return the names of all defined initialization parameters for this servlet.

Specified by:
findInitParameters in interface Wrapper

findMappings

public java.lang.String[] findMappings()
Return the mappings associated with this wrapper.

Specified by:
findMappings in interface Wrapper

findSecurityReference

public java.lang.String findSecurityReference(java.lang.String name)
Return the security role link for the specified security role reference name, if any; otherwise return null.

Specified by:
findSecurityReference in interface Wrapper
Parameters:
name - Security role reference used within this servlet

findSecurityReferences

public java.lang.String[] findSecurityReferences()
Return the set of security role reference names associated with this servlet, if any; otherwise return a zero-length array.

Specified by:
findSecurityReferences in interface Wrapper

findMappingObject

public Wrapper findMappingObject()
FIXME: Fooling introspection ...


load

public void load()
          throws javax.servlet.ServletException
Load and initialize an instance of this servlet, if there is not already at least one initialized instance. This can be used, for example, to load servlets that are marked in the deployment descriptor to be loaded at server startup time.

IMPLEMENTATION NOTE: Servlets whose classnames begin with org.apache.catalina. (so-called "container" servlets) are loaded by the same classloader that loaded this class, rather than the classloader for the current web application. This gives such classes access to Catalina internals, which are prevented for classes loaded for web applications.

Specified by:
load in interface Wrapper
Throws:
javax.servlet.ServletException - if the servlet init() method threw an exception
javax.servlet.ServletException - if some other loading problem occurs

loadServlet

public javax.servlet.Servlet loadServlet()
                                  throws javax.servlet.ServletException
Load and initialize an instance of this servlet, if there is not already at least one initialized instance. This can be used, for example, to load servlets that are marked in the deployment descriptor to be loaded at server startup time.

Throws:
javax.servlet.ServletException

removeInitParameter

public void removeInitParameter(java.lang.String name)
Remove the specified initialization parameter from this servlet.

Specified by:
removeInitParameter in interface Wrapper
Parameters:
name - Name of the initialization parameter to remove

removeInstanceListener

public void removeInstanceListener(InstanceListener listener)
Remove a listener no longer interested in InstanceEvents.

Specified by:
removeInstanceListener in interface Wrapper
Parameters:
listener - The listener to remove

removeMapping

public void removeMapping(java.lang.String mapping)
Remove a mapping associated with the wrapper.

Specified by:
removeMapping in interface Wrapper
Parameters:
mapping - The pattern to remove

removeSecurityReference

public void removeSecurityReference(java.lang.String name)
Remove any security role reference for the specified role name.

Specified by:
removeSecurityReference in interface Wrapper
Parameters:
name - Security role used within this servlet to be removed

toString

public java.lang.String toString()
Return a String representation of this component.

Overrides:
toString in class java.lang.Object

unavailable

public void unavailable(javax.servlet.UnavailableException unavailable)
Process an UnavailableException, marking this servlet as unavailable for the specified amount of time.

Specified by:
unavailable in interface Wrapper
Parameters:
unavailable - The exception that occurred, or null to mark this servlet as permanently unavailable

unload

public void unload()
            throws javax.servlet.ServletException
Unload all initialized instances of this servlet, after calling the destroy() method for each instance. This can be used, for example, prior to shutting down the entire servlet engine, or prior to reloading all of the classes from the Loader associated with our Loader's repository.

Specified by:
unload in interface Wrapper
Throws:
javax.servlet.ServletException - if an exception is thrown by the destroy() method

getInitParameter

public java.lang.String getInitParameter(java.lang.String name)
Return the initialization parameter value for the specified name, if any; otherwise return null.

Specified by:
getInitParameter in interface javax.servlet.ServletConfig
Parameters:
name - Name of the initialization parameter to retrieve
Returns:
a String containing the value of the initialization parameter, or null if the initialization parameter does not exist

getInitParameterNames

public java.util.Enumeration getInitParameterNames()
Return the set of initialization parameter names defined for this servlet. If none are defined, an empty Enumeration is returned.

Specified by:
getInitParameterNames in interface javax.servlet.ServletConfig
Returns:
an Enumeration of String objects containing the names of the servlet's initialization parameters

getServletContext

public javax.servlet.ServletContext getServletContext()
Return the servlet context with which this servlet is associated.

Specified by:
getServletContext in interface javax.servlet.ServletConfig
Returns:
a ServletContext object, used by the caller to interact with its servlet container
See Also:
ServletContext

getServletName

public java.lang.String getServletName()
Return the name of this servlet.

Specified by:
getServletName in interface javax.servlet.ServletConfig
Returns:
the name of the servlet instance

getProcessingTime

public long getProcessingTime()

setProcessingTime

public void setProcessingTime(long processingTime)

getMaxTime

public long getMaxTime()

setMaxTime

public void setMaxTime(long maxTime)

getMinTime

public long getMinTime()

setMinTime

public void setMinTime(long minTime)

getRequestCount

public int getRequestCount()

setRequestCount

public void setRequestCount(int requestCount)

getErrorCount

public int getErrorCount()

setErrorCount

public void setErrorCount(int errorCount)

incrementErrorCount

public void incrementErrorCount()
Increment the error count used for monitoring.

Specified by:
incrementErrorCount in interface Wrapper

getLoadTime

public long getLoadTime()

setLoadTime

public void setLoadTime(long loadTime)

getClassLoadTime

public int getClassLoadTime()

addDefaultMapper

protected void addDefaultMapper(java.lang.String mapperClass)
Add a default Mapper implementation if none have been configured explicitly.

Parameters:
mapperClass - Java class name of the default Mapper

isContainerProvidedServlet

protected boolean isContainerProvidedServlet(java.lang.String classname)
Return true if the specified class name represents a container provided servlet class that should be loaded by the server class loader.

Parameters:
classname - Name of the class to be checked

getAllDeclaredMethods

protected java.lang.reflect.Method[] getAllDeclaredMethods(java.lang.Class c)

start

public void start()
           throws LifecycleException
Start this component, pre-loading the servlet if the load-on-startup value is set appropriately.

Specified by:
start in interface Lifecycle
Overrides:
start in class ContainerBase
Throws:
LifecycleException - if a fatal error occurs during startup

stop

public void stop()
          throws LifecycleException
Stop this component, gracefully shutting down the servlet if it has been initialized.

Specified by:
stop in interface Lifecycle
Overrides:
stop in class ContainerBase
Throws:
LifecycleException - if a fatal error occurs during shutdown

registerJMX

protected void registerJMX(StandardContext ctx)

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listener,
                                       javax.management.NotificationFilter filter,
                                       java.lang.Object object)
                                throws javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.NotificationEmitter
Throws:
javax.management.ListenerNotFoundException

getNotificationInfo

public javax.management.MBeanNotificationInfo[] getNotificationInfo()
Specified by:
getNotificationInfo in interface javax.management.NotificationBroadcaster

addNotificationListener

public void addNotificationListener(javax.management.NotificationListener listener,
                                    javax.management.NotificationFilter filter,
                                    java.lang.Object object)
                             throws java.lang.IllegalArgumentException
Specified by:
addNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
java.lang.IllegalArgumentException

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listener)
                                throws javax.management.ListenerNotFoundException
Remove a JMX-NotificationListener

Specified by:
removeNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
javax.management.ListenerNotFoundException
See Also:
NotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener)

isEventProvider

public boolean isEventProvider()

isStateManageable

public boolean isStateManageable()

isStatisticsProvider

public boolean isStatisticsProvider()


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