Package org.apache.catalina
Interface Wrapper
-
- All Superinterfaces:
Container
- All Known Implementing Classes:
StandardWrapper
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
.- Version:
- $Revision: 1.3.6.1 $ $Date: 2008/04/17 18:37:01 $
- Author:
- Craig R. McClanahan
-
-
Field Summary
-
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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
addSecurityReference(String name, String link)
Add a new security role reference record to the set of records for this servlet.jakarta.servlet.Servlet
allocate()
Allocate an initialized instance of this Servlet that is ready to have itsservice()
method called.void
deallocate(jakarta.servlet.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 returnnull
.String[]
findInitParameters()
Return the names of all defined initialization parameters for this servlet.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 returnnull
.String[]
findSecurityReferences()
Return the set of security role reference names associated with this servlet, if any; otherwise return a zero-length array.long
getAvailable()
Return the available date/time for this servlet, in milliseconds since the epoch.String
getDescription()
Gets the description of this servlet.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).int
getMultipartFileSizeThreshold()
Gets the multipart file-size-thresholString
getMultipartLocation()
Gets the multipart locationlong
getMultipartMaxFileSize()
Gets the multipart max-file-sizelong
getMultipartMaxRequestSize()
Gets the multipart max-request-SizeString
getRunAs()
Return the run-as identity for this servlet.String
getServletClassName()
Return the fully qualified servlet class name for this servlet.String[]
getServletMethods()
Gets the names of the methods supported by the underlying servlet.String
getServletName()
Gets the name of the wrapped servler.boolean
isAsyncSupported()
Checks if the wrapped servlet has been annotated or flagged in the deployment descriptor as being able to support asynchronous operations.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.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
removeSecurityReference(String name)
Remove any security role reference for the specified role name.void
setAvailable(long available)
Set the available date/time for this servlet, in milliseconds since the epoch.void
setDescription(String description)
Sets the description of this servlet.void
setIsAsyncSupported(boolean isAsyncSupported)
Configures the wrapped servlet as either supporting or not supporting asynchronous operations.void
setJspFile(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
setMultipartFileSizeThreshold(int fileSizeThreshold)
Sets the multipart file-size-thresholdvoid
setMultipartLocation(String location)
Sets the multipart locationvoid
setMultipartMaxFileSize(long maxFileSize)
Sets the multipart max-file-sizevoid
setMultipartMaxRequestSize(long maxRequestSize)
Sets the multipart max-request-sizevoid
setRunAs(String runAs)
Set the run-as identity for this servlet.void
setServletClass(Class<? extends jakarta.servlet.Servlet> servletClass)
Sets the class object from which this servlet will be instantiated.void
setServletClassName(String className)
Set the fully qualified servlet class name for this servlet.void
unavailable(jakarta.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 thedestroy()
method for each instance.-
Methods inherited from interface org.apache.catalina.Container
addChild, addContainerListener, addPropertyChangeListener, backgroundProcess, findChild, findChildren, findContainerListeners, fireContainerEvent, getBackgroundProcessorDelay, getInfo, getLoader, getLogger, getManager, getMappingObject, getName, getParent, getParentClassLoader, getPipeline, getRealm, getResources, hasCustomPipeline, invoke, isCheckIfRequestIsSecure, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCheckIfRequestIsSecure, setLoader, setLogger, setManager, setName, setParent, setParentClassLoader, setRealm, setResources
-
-
-
-
Method Detail
-
getAvailable
long getAvailable()
Return 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
void 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
-
getJspFile
String getJspFile()
Return the context-relative URI of the JSP file for this servlet.
-
setJspFile
void setJspFile(String jspFile)
Set the context-relative URI of the JSP file for this servlet.- Parameters:
jspFile
- JSP file URI
-
getLoadOnStartup
int getLoadOnStartup()
Return the load-on-startup order value (negative value means load on first call).
-
setLoadOnStartup
void setLoadOnStartup(int value)
Set the load-on-startup order value (negative value means load on first call).- Parameters:
value
- New load-on-startup value
-
getRunAs
String getRunAs()
Return the run-as identity for this servlet.
-
setRunAs
void setRunAs(String runAs)
Set the run-as identity for this servlet.- Parameters:
runAs
- New run-as identity value
-
getServletClassName
String getServletClassName()
Return the fully qualified servlet class name for this servlet.
-
getServletName
String getServletName()
Gets the name of the wrapped servler.
-
setServletClassName
void setServletClassName(String className)
Set the fully qualified servlet class name for this servlet.- Parameters:
className
- Servlet class name
-
setServletClass
void setServletClass(Class<? extends jakarta.servlet.Servlet> servletClass)
Sets the class object from which this servlet will be instantiated.- Parameters:
servletClass
- the class object from which the servlet will be instantiated
-
getServletMethods
String[] getServletMethods() throws jakarta.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.- Returns:
- Array of names of the methods supported by the underlying servlet
- Throws:
jakarta.servlet.ServletException
-
isUnavailable
boolean isUnavailable()
Is this servlet currently unavailable?
-
setDescription
void setDescription(String description)
Sets the description of this servlet.
-
getDescription
String getDescription()
Gets the description of this servlet.
-
setMultipartLocation
void setMultipartLocation(String location)
Sets the multipart location
-
getMultipartLocation
String getMultipartLocation()
Gets the multipart location
-
setMultipartMaxFileSize
void setMultipartMaxFileSize(long maxFileSize)
Sets the multipart max-file-size
-
getMultipartMaxFileSize
long getMultipartMaxFileSize()
Gets the multipart max-file-size
-
setMultipartMaxRequestSize
void setMultipartMaxRequestSize(long maxRequestSize)
Sets the multipart max-request-size
-
getMultipartMaxRequestSize
long getMultipartMaxRequestSize()
Gets the multipart max-request-Size
-
setMultipartFileSizeThreshold
void setMultipartFileSizeThreshold(int fileSizeThreshold)
Sets the multipart file-size-threshold
-
getMultipartFileSizeThreshold
int getMultipartFileSizeThreshold()
Gets the multipart file-size-threshol
-
addInitParameter
void addInitParameter(String name, String value)
Add a new servlet initialization parameter for this servlet.- Parameters:
name
- Name of this initialization parameter to addvalue
- Value of this initialization parameter to add
-
addInstanceListener
void addInstanceListener(InstanceListener listener)
Add a new listener interested in InstanceEvents.- Parameters:
listener
- The new listener
-
addMapping
void addMapping(String mapping)
Add a mapping associated with the Wrapper.- Parameters:
mapping
- The new wrapper mapping
-
addSecurityReference
void addSecurityReference(String name, String link)
Add a new security role reference record to the set of records for this servlet.- Parameters:
name
- Role name used within this servletlink
- Role name used within the web application
-
allocate
jakarta.servlet.Servlet allocate() throws jakarta.servlet.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()
.- Throws:
jakarta.servlet.ServletException
- if the servlet init() method threw an exceptionjakarta.servlet.ServletException
- if a loading error occurs
-
deallocate
void deallocate(jakarta.servlet.Servlet servlet) throws jakarta.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.- Parameters:
servlet
- The servlet to be returned- Throws:
jakarta.servlet.ServletException
- if a deallocation error occurs
-
findInitParameter
String findInitParameter(String name)
Return the value for the specified initialization parameter name, if any; otherwise returnnull
.- Parameters:
name
- Name of the requested initialization parameter
-
findInitParameters
String[] findInitParameters()
Return the names of all defined initialization parameters for this servlet.
-
findMappings
String[] findMappings()
Return the mappings associated with this wrapper.
-
findSecurityReference
String findSecurityReference(String name)
Return the security role link for the specified security role reference name, if any; otherwise returnnull
.- Parameters:
name
- Security role reference used within this servlet
-
findSecurityReferences
String[] findSecurityReferences()
Return the set of security role reference names associated with this servlet, if any; otherwise return a zero-length array.
-
load
void load() throws jakarta.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:
jakarta.servlet.ServletException
- if the servlet init() method threw an exceptionjakarta.servlet.ServletException
- if some other loading problem occurs
-
removeInitParameter
void removeInitParameter(String name)
Remove the specified initialization parameter from this servlet.- Parameters:
name
- Name of the initialization parameter to remove
-
removeInstanceListener
void removeInstanceListener(InstanceListener listener)
Remove a listener no longer interested in InstanceEvents.- Parameters:
listener
- The listener to remove
-
removeMapping
void removeMapping(String mapping)
Remove a mapping associated with the wrapper.- Parameters:
mapping
- The pattern to remove
-
removeSecurityReference
void removeSecurityReference(String name)
Remove any security role reference for the specified role name.- Parameters:
name
- Security role used within this servlet to be removed
-
unavailable
void unavailable(jakarta.servlet.UnavailableException unavailable)
Process an UnavailableException, marking this servlet as unavailable for the specified amount of time.- Parameters:
unavailable
- The exception that occurred, ornull
to mark this servlet as permanently unavailable
-
unload
void unload() throws jakarta.servlet.ServletException
Unload 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:
jakarta.servlet.ServletException
- if an unload error occurs
-
setIsAsyncSupported
void setIsAsyncSupported(boolean isAsyncSupported)
Configures the wrapped servlet as either supporting or not supporting asynchronous operations.- Parameters:
isAsyncSupported
- true if the wrapped servlet supports asynchronous operations, false otherwise
-
isAsyncSupported
boolean isAsyncSupported()
Checks if the wrapped servlet has been annotated or flagged in the deployment descriptor as being able to support asynchronous operations.- Returns:
- true if the wrapped servlet supports async operations, and false otherwise
-
-