StandardWrapper (Apache Tomcat 7.0.103 API Documentation)

org.apache.catalina.core

## Class StandardWrapper

- java.lang.Object
- - org.apache.catalina.util.LifecycleBase
  - - org.apache.catalina.util.LifecycleMBeanBase
    - - org.apache.catalina.core.ContainerBase
      - - org.apache.catalina.core.StandardWrapper

- All Implemented Interfaces:
    MBeanRegistration, NotificationBroadcaster, NotificationEmitter, ServletConfig, Container, JmxEnabled, Lifecycle, Wrapper
  Direct Known Subclasses:
    Tomcat.ExistingStandardWrapper

      public class StandardWrapper
      extends ContainerBase
      implements ServletConfig, Wrapper, 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.
  Author:
    Craig R. McClanahan, Remy Maucherat

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.catalina.core.ContainerBase

      `ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild`

    - ### Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle

      `Lifecycle.SingleUse`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `asyncSupported` Async support
    `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 NotificationBroadcasterSupport` | `broadcaster` The broadcaster that sends j2ee notifications.
    `protected int` | `classLoadTime`
    `protected static Class<?>[]` | `classType` Static class array used when the SecurityManager is turned on and `Servlet.init` is invoked.
    `protected static Class<?>[]` | `classTypeUsedInService` Deprecated.
    `protected AtomicInteger` | `countAllocated` The count of allocations that are currently active (even if they are for the same instance, as will be true on a non-STM servlet).
    `protected static String[]` | `DEFAULT_SERVLET_METHODS`
    `protected boolean` | `enabled` Enabled
    `protected StandardWrapperFacade` | `facade` The facade associated with this wrapper.
    `protected static String` | `info` The descriptive information string for this implementation.
    `protected Servlet` | `instance` The (single) possibly uninitialized instance of this servlet.
    `protected boolean` | `instanceInitialized` Flag that indicates if this instance has been initialized
    `protected Stack<Servlet>` | `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 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 ArrayList<String>` | `mappings` Mappings associated with the wrapper.
    `protected int` | `maxInstances` Maximum number of STM instances.
    `protected MultipartConfigElement` | `multipartConfigElement` Multipart config
    `protected int` | `nInstances` Number of instances currently loaded for a STM servlet.
    `protected MBeanNotificationInfo[]` | `notificationInfo`
    `protected HashMap<String,String>` | `parameters` The initialization parameters for this servlet, keyed by parameter name.
    `protected HashMap<String,String>` | `references` The security role references for this servlet, keyed by role name used in the servlet.
    `protected String` | `runAs` The run-as identity for this servlet.
    `protected long` | `sequenceNumber` The notification sequence number.
    `protected String` | `servletClass` The fully qualified servlet class name for this servlet.
    `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

      `accessLog, backgroundProcessorDelay, children, cluster, listeners, loader, logger, logName, manager, name, parent, parentClassLoader, pipeline, resources, sm, startChildren, startStopExecutor, support`

    - ### Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase

      `mserver`

    - ### Fields inherited from interface org.apache.catalina.Wrapper

      `ADD_MAPPING_EVENT, REMOVE_MAPPING_EVENT`

    - ### 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_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StandardWrapper()` Create a new StandardWrapper component with the default basic Valve.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChild(Container child)` Refuse to add a child Container, because Wrappers are the lowest level of the Container hierarchy.
    `void` | `addInitParameter(String name, String value)` Add a new servlet initialization parameter for this servlet.
    `void` | `addInstanceListener(InstanceListener listener)` Add a new listener interested in InstanceEvents.
    `void` | `addMapping(String mapping)` Add a mapping associated with the Wrapper.
    `void` | `addNotificationListener(NotificationListener listener, NotificationFilter filter, Object object)`
    `void` | `addSecurityReference(String name, String link)` Add a new security role reference record to the set of records for this 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(Servlet servlet)` Return this previously allocated servlet to the pool of available instances.
    `String` | `findInitParameter(String name)` Return the value for the specified initialization parameter name, if any; otherwise return `null`.
    `String[]` | `findInitParameters()` Return the names of all defined initialization parameters for this servlet.
    `Wrapper` | `findMappingObject()` Deprecated.
    `String[]` | `findMappings()` Return the mappings associated with this wrapper.
    `String` | `findSecurityReference(String name)` Return the security role link for the specified security role reference name, if any; otherwise return `null`.
    `String[]` | `findSecurityReferences()` Return the set of security role reference names associated with this servlet, if any; otherwise return a zero-length array.
    `protected Method[]` | `getAllDeclaredMethods(Class<?> c)`
    `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, even if they are all for the same instance (as will be true for servlets that do not implement `SingleThreadModel`.
    `int` | `getErrorCount()`
    `String` | `getInfo()` Return descriptive information about this Container implementation and the corresponding version number, in the format `<description>/<version>`.
    `String` | `getInitParameter(String name)` Return the initialization parameter value for the specified name, if any; otherwise return `null`.
    `Enumeration<String>` | `getInitParameterNames()` Return the set of initialization parameter names defined for this servlet.
    `InstanceSupport` | `getInstanceSupport()` Return the InstanceSupport object for this Wrapper instance.
    `int` | `getLoadOnStartup()` Return the load-on-startup order value (negative value means load on first call).
    `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()`
    `MultipartConfigElement` | `getMultipartConfigElement()`
    `MBeanNotificationInfo[]` | `getNotificationInfo()`
    `protected String` | `getObjectNameKeyProperties()` Allow sub-classes to specify the key properties component of the `ObjectName` that will be used to register this component.
    `long` | `getProcessingTime()`
    `int` | `getRequestCount()`
    `static Throwable` | `getRootCause(ServletException e)` Extract the root cause from a servlet exception.
    `String` | `getRunAs()` Return the run-as identity for this servlet.
    `Servlet` | `getServlet()` Return the associated servlet instance.
    `String` | `getServletClass()` Return the fully qualified servlet class name for this servlet.
    `ServletContext` | `getServletContext()` Return the servlet context with which this servlet is associated.
    `String[]` | `getServletMethods()` Gets the names of the methods supported by the underlying servlet.
    `String` | `getServletName()` Return the name of this servlet.
    `void` | `incrementErrorCount()` Increment the error count used for monitoring.
    `boolean` | `isAsyncSupported()` Does the associated Servlet support async processing?
    `protected boolean` | `isContainerProvidedServlet(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` | `isEnabled()` Is the associated Servlet enabled?
    `boolean` | `isEventProvider()` Deprecated.
    `boolean` | `isOverridable()` Is the Servlet overridable by a ServletContainerInitializer?
    `Boolean` | `isSingleThreadModel()` Does the servlet class represented by this component implement the `SingleThreadModel` interface?
    `boolean` | `isStateManageable()` JSR 77.
    `boolean` | `isStatisticsProvider()` Deprecated.
    `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.
    `Servlet` | `loadServlet()` Load and initialize an instance of this servlet, if there is not already at least one initialized instance.
    `void` | `removeInitParameter(String name)` Remove the specified initialization parameter from this servlet.
    `void` | `removeInstanceListener(InstanceListener listener)` Remove a listener no longer interested in InstanceEvents.
    `void` | `removeMapping(String mapping)` Remove a mapping associated with the wrapper.
    `void` | `removeNotificationListener(NotificationListener listener)` Remove a JMX-NotificationListener
    `void` | `removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object object)`
    `void` | `removeSecurityReference(String name)` Remove any security role reference for the specified role name.
    `void` | `servletSecurityAnnotationScan()` This method is no longer used.
    `void` | `setAsyncSupported(boolean asyncSupported)` Set the async support for the associated Servlet.
    `void` | `setAvailable(long available)` Set the available date/time for this servlet, in milliseconds since the epoch.
    `void` | `setEnabled(boolean enabled)` Sets the enabled attribute for the associated servlet.
    `void` | `setErrorCount(int errorCount)` Deprecated.
    `void` | `setLoadOnStartup(int value)` Set the load-on-startup order value (negative value means load on first call).
    `void` | `setLoadOnStartupString(String value)` Set the load-on-startup order value from a (possibly null) string.
    `void` | `setLoadTime(long loadTime)` Deprecated.
    `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)` Deprecated.
    `void` | `setMinTime(long minTime)` Deprecated.
    `void` | `setMultipartConfigElement(MultipartConfigElement multipartConfigElement)` Set the multi-part configuration for the associated Servlet.
    `void` | `setOverridable(boolean overridable)` Sets the overridable attribute 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)` Deprecated.
    `void` | `setRequestCount(int requestCount)` Deprecated.
    `void` | `setRunAs(String runAs)` Set the run-as identity for this servlet.
    `void` | `setServlet(Servlet servlet)` Set the associated servlet instance.
    `void` | `setServletClass(String servletClass)` Set the fully qualified servlet class name for this servlet.
    `void` | `setServletName(String name)` Set the name of this servlet.
    `void` | `setServletSecurityAnnotationScanRequired(boolean b)` This method is no longer used.
    `protected void` | `startInternal()` Start this component and implement the requirements of `LifecycleBase.startInternal()`.
    `protected void` | `stopInternal()` Stop this component and implement the requirements of `LifecycleBase.stopInternal()`.
    `String` | `toString()` Return a String representation of this component.
    `void` | `unavailable(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, addPropertyChangeListener, addValve, destroyInternal, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getChildren, getCluster, getClusterInternal, getDomainInternal, getLoader, getLoaderInternal, getLogger, getManager, getManagerInternal, getMappingObject, getName, getParent, getParentClassLoader, getPipeline, getRealm, getRealmInternal, getResources, getResourcesInternal, getStartChildren, getStartStopThreads, initInternal, invoke, logAccess, logName, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setLoader, setManager, setName, setParentClassLoader, setRealm, setResources, setStartChildren, setStartStopThreads, threadStart, threadStop`

    - ### Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase

      `getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister`

    - ### Methods inherited from class org.apache.catalina.util.LifecycleBase

      `addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop`

    - ### 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, getAccessLog, getBackgroundProcessorDelay, getCluster, getLoader, getLogger, getManager, getMappingObject, getName, getObjectName, getParent, getParentClassLoader, getPipeline, getRealm, getResources, getStartStopThreads, invoke, logAccess, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setLoader, setManager, setName, setParentClassLoader, setRealm, setResources, setStartStopThreads`

    - ### Methods inherited from interface org.apache.catalina.Lifecycle

      `addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop`

- - ### Field Detail

    - #### DEFAULT_SERVLET_METHODS

          protected static final String[] DEFAULT_SERVLET_METHODS

    - #### 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 NotificationBroadcasterSupport broadcaster

      The broadcaster that sends j2ee notifications.

    - #### countAllocated

          protected AtomicInteger countAllocated

      The count of allocations that are currently active (even if they are for the same instance, as will be true on a non-STM servlet).

    - #### facade

          protected StandardWrapperFacade facade

      The facade associated with this wrapper.

    - #### info

          protected static final String info

      The descriptive information string for this implementation.
      See Also:
        Constant Field Values

    - #### instance

          protected volatile Servlet instance

      The (single) possibly uninitialized instance of this servlet.

    - #### instanceInitialized

          protected volatile boolean instanceInitialized

      Flag that indicates if this instance has been initialized

    - #### instanceSupport

          protected InstanceSupport instanceSupport

      The support object for our instance listeners.

    - #### loadOnStartup

          protected int loadOnStartup

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

    - #### mappings

          protected ArrayList<String> mappings

      Mappings associated with the wrapper.

    - #### parameters

          protected HashMap<String,String> parameters

      The initialization parameters for this servlet, keyed by parameter name.

    - #### references

          protected HashMap<String,String> 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 String runAs

      The run-as identity for this servlet.

    - #### sequenceNumber

          protected long sequenceNumber

      The notification sequence number.

    - #### servletClass

          protected String servletClass

      The fully qualified servlet class name for this servlet.

    - #### singleThreadModel

          protected volatile boolean singleThreadModel

      Does this servlet implement the SingleThreadModel interface?

    - #### unloading

          protected volatile 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 Stack<Servlet> 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 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

    - #### multipartConfigElement

          protected MultipartConfigElement multipartConfigElement

      Multipart config

    - #### asyncSupported

          protected boolean asyncSupported

      Async support

    - #### enabled

          protected boolean enabled

      Enabled

    - #### classType

          protected static Class<?>[] classType

      Static class array used when the SecurityManager is turned on and `Servlet.init` is invoked.

    - #### classTypeUsedInService

          @Deprecated
          protected static Class<?>[] classTypeUsedInService

      Deprecated.
      Static class array used when the SecurityManager is turned on and `Servlet.service` is invoked.

    - #### notificationInfo

          protected MBeanNotificationInfo[] notificationInfo

  - ### Constructor Detail

    - #### StandardWrapper

          public StandardWrapper()

      Create a new StandardWrapper component with the default basic Valve.

  - ### Method Detail

    - #### isOverridable

          public boolean isOverridable()

      Description copied from interface: `Wrapper`
      Is the Servlet overridable by a ServletContainerInitializer?
      Specified by:
        `isOverridable` in interface `Wrapper`
      Returns:
        `true` if the Servlet can be overridden in a ServletContainerInitializer

    - #### setOverridable

          public void setOverridable(boolean overridable)

      Description copied from interface: `Wrapper`
      Sets the overridable attribute for this Servlet.
      Specified by:
        `setOverridable` in interface `Wrapper`
      Parameters:
        `overridable` - the new 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`
      Returns:
        the available date/time for this servlet, in milliseconds since the epoch. 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. A value equal to Long.MAX_VALUE is considered to mean that unavailability is permanent.

    - #### 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, even if they are all for the same instance (as will be true for servlets that do not implement `SingleThreadModel`.

    - #### getInfo

          public 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`
      Returns:
        descriptive information about this Container implementation and the corresponding version number, in the format `<description>/<version>`.

    - #### getInstanceSupport

          public InstanceSupport getInstanceSupport()

      Return the InstanceSupport object for this Wrapper instance.

    - #### getLoadOnStartup

          public int getLoadOnStartup()

      Return the load-on-startup order value (negative value means load on first call).
      Specified by:
        `getLoadOnStartup` in interface `Wrapper`
      Returns:
        the load-on-startup order value (negative value means load on first call).

    - #### 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(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 String getLoadOnStartupString()

    - #### 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 String getRunAs()

      Return the run-as identity for this servlet.
      Specified by:
        `getRunAs` in interface `Wrapper`
      Returns:
        the run-as identity for this servlet.

    - #### setRunAs

          public void setRunAs(String runAs)

      Set the run-as identity for this servlet.
      Specified by:
        `setRunAs` in interface `Wrapper`
      Parameters:
        `runAs` - New run-as identity value

    - #### getServletClass

          public String getServletClass()

      Return the fully qualified servlet class name for this servlet.
      Specified by:
        `getServletClass` in interface `Wrapper`
      Returns:
        the fully qualified servlet class name for this servlet.

    - #### setServletClass

          public void setServletClass(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(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()

      Does the servlet class represented by this component implement the `SingleThreadModel` interface? This can only be determined once the class is loaded. Calling this method will not trigger loading the class since that may cause the application to behave unexpectedly.
      Returns:
        `null` if the class has not been loaded, otherwise `true` if the servlet does implement `SingleThreadModel` and `false` if it does not.

    - #### isUnavailable

          public boolean isUnavailable()

      Is this servlet currently unavailable?
      Specified by:
        `isUnavailable` in interface `Wrapper`
      Returns:
        `true` if this Servlet is currently unavailable.

    - #### getServletMethods

          public String[] getServletMethods()
                                     throws 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:
        `ServletException` - If the target servlet cannot be loaded

    - #### getServlet

          public Servlet getServlet()

      Return the associated servlet instance.
      Specified by:
        `getServlet` in interface `Wrapper`
      Returns:
        the associated Servlet instance.

    - #### setServlet

          public void setServlet(Servlet servlet)

      Set the associated servlet instance.
      Specified by:
        `setServlet` in interface `Wrapper`
      Parameters:
        `servlet` - The associated Servlet

    - #### setServletSecurityAnnotationScanRequired

          public void setServletSecurityAnnotationScanRequired(boolean b)

      This method is no longer used. All implementations should be NO-OPs.
      Specified by:
        `setServletSecurityAnnotationScanRequired` in interface `Wrapper`
      Parameters:
        `b` - Unused.

    - #### 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 Throwable getRootCause(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(String name,
                              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(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(String name,
                                  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

    - #### allocate

          public Servlet allocate()
                           throws 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`
      Returns:
        a new Servlet instance
      Throws:
        `ServletException` - if the servlet init() method threw an exception
        `ServletException` - if a loading error occurs

    - #### deallocate

          public void deallocate(Servlet servlet)
                          throws 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:
        `ServletException` - if a deallocation error occurs

    - #### findInitParameter

          public String findInitParameter(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
      Returns:
        the value for the specified initialization parameter name, if any; otherwise return `null`.

    - #### findInitParameters

          public String[] findInitParameters()

      Return the names of all defined initialization parameters for this servlet.
      Specified by:
        `findInitParameters` in interface `Wrapper`
      Returns:
        the names of all defined initialization parameters for this servlet.

    - #### findMappings

          public String[] findMappings()

      Return the mappings associated with this wrapper.
      Specified by:
        `findMappings` in interface `Wrapper`
      Returns:
        the mappings associated with this wrapper.

    - #### findSecurityReference

          public String findSecurityReference(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
      Returns:
        the security role link for the specified security role reference name, if any; otherwise return `null`.

    - #### findSecurityReferences

          public 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`
      Returns:
        the set of security role reference names associated with this servlet, if any; otherwise return a zero-length array.

    - #### findMappingObject

          @Deprecated
          public Wrapper findMappingObject()

      Deprecated.
      FIXME: Fooling introspection ...

    - #### load

          public void load()
                    throws 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:
        `ServletException` - if the servlet init() method threw an exception
        `ServletException` - if some other loading problem occurs

    - #### loadServlet

          public Servlet loadServlet()
                              throws 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:
        `ServletException`

    - #### servletSecurityAnnotationScan

          public void servletSecurityAnnotationScan()
                                             throws ServletException

      This method is no longer used. All implementations should be NO-OPs.
      Specified by:
        `servletSecurityAnnotationScan` in interface `Wrapper`
      Throws:
        `ServletException` - Never thrown

    - #### removeInitParameter

          public void removeInitParameter(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(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(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 String toString()

      Return a String representation of this component.
      Overrides:
        `toString` in class `Object`

    - #### unavailable

          public void unavailable(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 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:
        `ServletException` - if an exception is thrown by the destroy() method

    - #### getInitParameter

          public String getInitParameter(String name)

      Return the initialization parameter value for the specified name, if any; otherwise return `null`.
      Specified by:
        `getInitParameter` in interface `ServletConfig`
      Parameters:
        `name` - Name of the initialization parameter to retrieve
      Returns:
        a `String` containing the value of the initialization parameter

    - #### getInitParameterNames

          public Enumeration<String> 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 `ServletConfig`
      Returns:
        an `Enumeration` of `String` objects containing the names of the servlet's initialization parameters

    - #### getServletContext

          public ServletContext getServletContext()

      Return the servlet context with which this servlet is associated.
      Specified by:
        `getServletContext` in interface `ServletConfig`
      Returns:
        a `ServletContext` object, used by the caller to interact with its servlet container
      See Also:
        `ServletContext`

    - #### getServletName

          public String getServletName()

      Return the name of this servlet.
      Specified by:
        `getServletName` in interface `ServletConfig`
      Returns:
        the name of the servlet instance

    - #### getProcessingTime

          public long getProcessingTime()

    - #### setProcessingTime

          @Deprecated
          public void setProcessingTime(long processingTime)

      Deprecated.

    - #### getMaxTime

          public long getMaxTime()

    - #### setMaxTime

          @Deprecated
          public void setMaxTime(long maxTime)

      Deprecated.

    - #### getMinTime

          public long getMinTime()

    - #### setMinTime

          @Deprecated
          public void setMinTime(long minTime)

      Deprecated.

    - #### getRequestCount

          public int getRequestCount()

    - #### setRequestCount

          @Deprecated
          public void setRequestCount(int requestCount)

      Deprecated.

    - #### getErrorCount

          public int getErrorCount()

    - #### setErrorCount

          @Deprecated
          public void setErrorCount(int errorCount)

      Deprecated.

    - #### incrementErrorCount

          public void incrementErrorCount()

      Increment the error count used for monitoring.
      Specified by:
        `incrementErrorCount` in interface `Wrapper`

    - #### getLoadTime

          public long getLoadTime()

    - #### setLoadTime

          @Deprecated
          public void setLoadTime(long loadTime)

      Deprecated.

    - #### getClassLoadTime

          public int getClassLoadTime()

    - #### getMultipartConfigElement

          public MultipartConfigElement getMultipartConfigElement()

      Specified by:
        `getMultipartConfigElement` in interface `Wrapper`
      Returns:
        the multi-part configuration for the associated Servlet. If no multi-part configuration has been defined, then `null` will be returned.

    - #### setMultipartConfigElement

          public void setMultipartConfigElement(MultipartConfigElement multipartConfigElement)

      Description copied from interface: `Wrapper`
      Set the multi-part configuration for the associated Servlet. To clear the multi-part configuration specify `null` as the new value.
      Specified by:
        `setMultipartConfigElement` in interface `Wrapper`
      Parameters:
        `multipartConfigElement` - The configuration associated with the Servlet

    - #### isAsyncSupported

          public boolean isAsyncSupported()

      Description copied from interface: `Wrapper`
      Does the associated Servlet support async processing? Defaults to `false`.
      Specified by:
        `isAsyncSupported` in interface `Wrapper`
      Returns:
        `true` if the Servlet supports async

    - #### setAsyncSupported

          public void setAsyncSupported(boolean asyncSupported)

      Description copied from interface: `Wrapper`
      Set the async support for the associated Servlet.
      Specified by:
        `setAsyncSupported` in interface `Wrapper`
      Parameters:
        `asyncSupported` - the new value

    - #### isEnabled

          public boolean isEnabled()

      Description copied from interface: `Wrapper`
      Is the associated Servlet enabled? Defaults to `true`.
      Specified by:
        `isEnabled` in interface `Wrapper`
      Returns:
        `true` if the Servlet is enabled

    - #### setEnabled

          public void setEnabled(boolean enabled)

      Description copied from interface: `Wrapper`
      Sets the enabled attribute for the associated servlet.
      Specified by:
        `setEnabled` in interface `Wrapper`
      Parameters:
        `enabled` - the new value

    - #### isContainerProvidedServlet

          protected boolean isContainerProvidedServlet(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 Method[] getAllDeclaredMethods(Class<?> c)

    - #### startInternal

          protected void startInternal()
                                throws LifecycleException

      Start this component and implement the requirements of `LifecycleBase.startInternal()`.
      Overrides:
        `startInternal` in class `ContainerBase`
      Throws:
        `LifecycleException` - if this component detects a fatal error that prevents this component from being used

    - #### stopInternal

          protected void stopInternal()
                               throws LifecycleException

      Stop this component and implement the requirements of `LifecycleBase.stopInternal()`.
      Overrides:
        `stopInternal` in class `ContainerBase`
      Throws:
        `LifecycleException` - if this component detects a fatal error that prevents this component from being used

    - #### getObjectNameKeyProperties

          protected String getObjectNameKeyProperties()

      Description copied from class: `LifecycleMBeanBase`
      Allow sub-classes to specify the key properties component of the `ObjectName` that will be used to register this component.
      Specified by:
        `getObjectNameKeyProperties` in class `LifecycleMBeanBase`
      Returns:
        The string representation of the key properties component of the desired `ObjectName`

    - #### isStateManageable

          public boolean isStateManageable()

      JSR 77. Always return false.

    - #### removeNotificationListener

          public void removeNotificationListener(NotificationListener listener,
                                        NotificationFilter filter,
                                        Object object)
                                          throws ListenerNotFoundException

      Specified by:
        `removeNotificationListener` in interface `NotificationEmitter`
      Throws:
        `ListenerNotFoundException`

    - #### getNotificationInfo

          public MBeanNotificationInfo[] getNotificationInfo()

      Specified by:
        `getNotificationInfo` in interface `NotificationBroadcaster`

    - #### addNotificationListener

          public void addNotificationListener(NotificationListener listener,
                                     NotificationFilter filter,
                                     Object object)
                                       throws IllegalArgumentException

      Specified by:
        `addNotificationListener` in interface `NotificationBroadcaster`
      Throws:
        `IllegalArgumentException`

    - #### removeNotificationListener

          public void removeNotificationListener(NotificationListener listener)
                                          throws ListenerNotFoundException

      Remove a JMX-NotificationListener
      Specified by:
        `removeNotificationListener` in interface `NotificationBroadcaster`
      Throws:
        `ListenerNotFoundException`
      See Also:
        `NotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener)`

    - #### isEventProvider

          @Deprecated
          public boolean isEventProvider()

      Deprecated.

    - #### isStatisticsProvider

          @Deprecated
          public boolean isStatisticsProvider()

      Deprecated.

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