Package org.apache.catalina
Interface Wrapper
- 
- All Known Implementing Classes:
- StandardWrapper,- Tomcat.ExistingStandardWrapper
 
 public interface Wrapper extends Container A Wrapper is a Container that represents an individual servlet definition from the deployment descriptor of the web application. It provides a convenient mechanism to use Interceptors that see every single request to the servlet represented by this definition.Implementations of Wrapper are responsible for managing the servlet life cycle for their underlying servlet class, including calling init() and destroy() at appropriate times, as well as respecting the existence of the SingleThreadModel declaration on the servlet class itself. The parent Container attached to a Wrapper will generally be an implementation of Context, representing the servlet context (and therefore the web application) within which this servlet executes. Child Containers are not allowed on Wrapper implementations, so the addChild()method should throw anIllegalArgumentException.- Author:
- Craig R. McClanahan
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringADD_MAPPING_EVENTContainer event for adding a wrapper.static java.lang.StringREMOVE_MAPPING_EVENTContainer event for removing a wrapper.- 
Fields inherited from interface org.apache.catalina.ContainerADD_CHILD_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_VALVE_EVENT
 - 
Fields inherited from interface org.apache.catalina.LifecycleAFTER_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
 
- 
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddInitParameter(java.lang.String name, java.lang.String value)Add a new servlet initialization parameter for this servlet.voidaddMapping(java.lang.String mapping)Add a mapping associated with the Wrapper.voidaddSecurityReference(java.lang.String name, java.lang.String link)Add a new security role reference record to the set of records for this servlet.Servletallocate()Allocate an initialized instance of this Servlet that is ready to have itsservice()method called.voiddeallocate(Servlet servlet)Return this previously allocated servlet to the pool of available instances.java.lang.StringfindInitParameter(java.lang.String name)java.lang.String[]findInitParameters()java.lang.String[]findMappings()java.lang.StringfindSecurityReference(java.lang.String name)java.lang.String[]findSecurityReferences()longgetAvailable()intgetLoadOnStartup()MultipartConfigElementgetMultipartConfigElement()java.lang.StringgetRunAs()ServletgetServlet()java.lang.StringgetServletClass()java.lang.String[]getServletMethods()Gets the names of the methods supported by the underlying servlet.voidincrementErrorCount()Increment the error count value used when monitoring.booleanisAsyncSupported()Does the associated Servlet support async processing?booleanisEnabled()Is the associated Servlet enabled?booleanisOverridable()Is the Servlet overridable by a ServletContainerInitializer?booleanisUnavailable()voidload()Load and initialize an instance of this Servlet, if there is not already at least one initialized instance.voidremoveInitParameter(java.lang.String name)Remove the specified initialization parameter from this Servlet.voidremoveMapping(java.lang.String mapping)Remove a mapping associated with the wrapper.voidremoveSecurityReference(java.lang.String name)Remove any security role reference for the specified role name.voidsetAsyncSupported(boolean asyncSupport)Set the async support for the associated Servlet.voidsetAvailable(long available)Set the available date/time for this servlet, in milliseconds since the epoch.voidsetEnabled(boolean enabled)Sets the enabled attribute for the associated servlet.voidsetLoadOnStartup(int value)Set the load-on-startup order value (negative value means load on first call).voidsetMultipartConfigElement(MultipartConfigElement multipartConfig)Set the multi-part configuration for the associated Servlet.voidsetOverridable(boolean overridable)Sets the overridable attribute for this Servlet.voidsetRunAs(java.lang.String runAs)Set the run-as identity for this servlet.voidsetServlet(Servlet servlet)Set the associated Servlet instancevoidsetServletClass(java.lang.String servletClass)Set the fully qualified servlet class name for this servlet.voidunavailable(UnavailableException unavailable)Process an UnavailableException, marking this Servlet as unavailable for the specified amount of time.voidunload()Unload all initialized instances of this servlet, after calling thedestroy()method for each instance.- 
Methods inherited from interface org.apache.catalina.ContaineraddChild, addContainerListener, addPropertyChangeListener, backgroundProcess, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getCatalinaBase, getCatalinaHome, getCluster, getDomain, getLogger, getLogName, getMBeanKeyProperties, getName, getObjectName, getParent, getParentClassLoader, getPipeline, getRealm, getStartStopThreads, logAccess, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setName, setParent, setParentClassLoader, setRealm, setStartStopThreads
 - 
Methods inherited from interface org.apache.catalina.LifecycleaddLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
 
- 
 
- 
- 
- 
Field Detail- 
ADD_MAPPING_EVENTstatic final java.lang.String ADD_MAPPING_EVENT Container event for adding a wrapper.- See Also:
- Constant Field Values
 
 - 
REMOVE_MAPPING_EVENTstatic final java.lang.String REMOVE_MAPPING_EVENT Container event for removing a wrapper.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getAvailablelong getAvailable() - 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.
 
 - 
setAvailablevoid setAvailable(long available) Set 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. A value equal to Long.MAX_VALUE is considered to mean that unavailability is permanent.- Parameters:
- available- The new available date/time
 
 - 
getLoadOnStartupint getLoadOnStartup() - Returns:
- the load-on-startup order value (negative value means load on first call).
 
 - 
setLoadOnStartupvoid setLoadOnStartup(int value) Set the load-on-startup order value (negative value means load on first call).- Parameters:
- value- New load-on-startup value
 
 - 
getRunAsjava.lang.String getRunAs() - Returns:
- the run-as identity for this servlet.
 
 - 
setRunAsvoid setRunAs(java.lang.String runAs) Set the run-as identity for this servlet.- Parameters:
- runAs- New run-as identity value
 
 - 
getServletClassjava.lang.String getServletClass() - Returns:
- the fully qualified servlet class name for this servlet.
 
 - 
setServletClassvoid setServletClass(java.lang.String servletClass) Set the fully qualified servlet class name for this servlet.- Parameters:
- servletClass- Servlet class name
 
 - 
getServletMethodsjava.lang.String[] getServletMethods() throws ServletExceptionGets 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.- Returns:
- Array of names of the methods supported by the underlying servlet
- Throws:
- ServletException- If the target servlet cannot be loaded
 
 - 
isUnavailableboolean isUnavailable() - Returns:
- trueif this Servlet is currently unavailable.
 
 - 
getServletServlet getServlet() - Returns:
- the associated Servlet instance.
 
 - 
setServletvoid setServlet(Servlet servlet) Set the associated Servlet instance- Parameters:
- servlet- The associated Servlet
 
 - 
addInitParametervoid addInitParameter(java.lang.String name, java.lang.String value)Add a new servlet initialization parameter for this servlet.- Parameters:
- name- Name of this initialization parameter to add
- value- Value of this initialization parameter to add
 
 - 
addMappingvoid addMapping(java.lang.String mapping) Add a mapping associated with the Wrapper.- Parameters:
- mapping- The new wrapper mapping
 
 - 
addSecurityReferencevoid addSecurityReference(java.lang.String name, java.lang.String link)Add a new security role reference record to the set of records for this servlet.- Parameters:
- name- Role name used within this servlet
- link- Role name used within the web application
 
 - 
allocateServlet allocate() throws ServletException Allocate an initialized instance of this Servlet that is ready to have itsservice()method called. If the Servlet class does not implementSingleThreadModel, the (only) initialized instance may be returned immediately. If the Servlet class implementsSingleThreadModel, the Wrapper implementation must ensure that this instance is not allocated again until it is deallocated by a call todeallocate().- Returns:
- a new Servlet instance
- Throws:
- ServletException- if the Servlet init() method threw an exception
- ServletException- if a loading error occurs
 
 - 
deallocatevoid 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.- Parameters:
- servlet- The servlet to be returned
- Throws:
- ServletException- if a deallocation error occurs
 
 - 
findInitParameterjava.lang.String findInitParameter(java.lang.String name) - Parameters:
- name- Name of the requested initialization parameter
- Returns:
- the value for the specified initialization parameter name,
 if any; otherwise return null.
 
 - 
findInitParametersjava.lang.String[] findInitParameters() - Returns:
- the names of all defined initialization parameters for this servlet.
 
 - 
findMappingsjava.lang.String[] findMappings() - Returns:
- the mappings associated with this wrapper.
 
 - 
findSecurityReferencejava.lang.String findSecurityReference(java.lang.String name) - 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.
 
 - 
findSecurityReferencesjava.lang.String[] findSecurityReferences() - Returns:
- the set of security role reference names associated with this servlet, if any; otherwise return a zero-length array.
 
 - 
incrementErrorCountvoid incrementErrorCount() Increment the error count value used when monitoring.
 - 
loadvoid 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.- Throws:
- ServletException- if the Servlet init() method threw an exception or if some other loading problem occurs
 
 - 
removeInitParametervoid removeInitParameter(java.lang.String name) Remove the specified initialization parameter from this Servlet.- Parameters:
- name- Name of the initialization parameter to remove
 
 - 
removeMappingvoid removeMapping(java.lang.String mapping) Remove a mapping associated with the wrapper.- Parameters:
- mapping- The pattern to remove
 
 - 
removeSecurityReferencevoid removeSecurityReference(java.lang.String name) Remove any security role reference for the specified role name.- Parameters:
- name- Security role used within this servlet to be removed
 
 - 
unavailablevoid unavailable(UnavailableException unavailable) Process an UnavailableException, marking this Servlet as unavailable for the specified amount of time.- Parameters:
- unavailable- The exception that occurred, or- nullto mark this Servlet as permanently unavailable
 
 - 
unloadvoid unload() throws ServletExceptionUnload all initialized instances of this servlet, after calling thedestroy()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.- Throws:
- ServletException- if an unload error occurs
 
 - 
getMultipartConfigElementMultipartConfigElement getMultipartConfigElement() - Returns:
- the multi-part configuration for the associated Servlet. If no
 multi-part configuration has been defined, then nullwill be returned.
 
 - 
setMultipartConfigElementvoid setMultipartConfigElement(MultipartConfigElement multipartConfig) Set the multi-part configuration for the associated Servlet. To clear the multi-part configuration specifynullas the new value.- Parameters:
- multipartConfig- The configuration associated with the Servlet
 
 - 
isAsyncSupportedboolean isAsyncSupported() Does the associated Servlet support async processing? Defaults tofalse.- Returns:
- trueif the Servlet supports async
 
 - 
setAsyncSupportedvoid setAsyncSupported(boolean asyncSupport) Set the async support for the associated Servlet.- Parameters:
- asyncSupport- the new value
 
 - 
isEnabledboolean isEnabled() Is the associated Servlet enabled? Defaults totrue.- Returns:
- trueif the Servlet is enabled
 
 - 
setEnabledvoid setEnabled(boolean enabled) Sets the enabled attribute for the associated servlet.- Parameters:
- enabled- the new value
 
 - 
isOverridableboolean isOverridable() Is the Servlet overridable by a ServletContainerInitializer?- Returns:
- trueif the Servlet can be overridden in a ServletContainerInitializer
 
 - 
setOverridablevoid setOverridable(boolean overridable) Sets the overridable attribute for this Servlet.- Parameters:
- overridable- the new value
 
 
- 
 
-