Package org.apache.catalina.core
Class StandardWrapper
- java.lang.Object
-
- org.apache.catalina.core.ContainerBase
-
- org.apache.catalina.core.StandardWrapper
-
public class StandardWrapper extends ContainerBase implements jakarta.servlet.ServletConfig, Wrapper
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: 1.12.2.1 $ $Date: 2008/04/17 18:37:09 $
- 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
Fields Modifier and Type Field Description protected boolean
instanceInitialized
Flag that indicates if this instance has been initializedprotected long
unloadDelay
Wait time for servlet unload in ms.-
Fields inherited from class org.apache.catalina.core.ContainerBase
backgroundProcessorDelay, checkIfRequestIsSecure, children, controller, domain, hasCustomPipeline, initialized, lifecycle, listeners, loader, log, logger, manager, name, notifyContainerListeners, oname, parent, parentClassLoader, pipeline, rb, readLock, realm, resources, started, support, writeLock
-
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, INIT_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description StandardWrapper()
Create a new StandardWrapper component with the default basic Valve.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(Container child)
Refuse to add a child Container, because Wrappers are the lowest level of the Container hierarchy.protected void
addDefaultMapper(String mapperClass)
Add a default Mapper implementation if none have been configured explicitly.void
addInitParameter(String name, String value)
Adds the initialization parameter with the given name and value to this servlet.void
addInstanceListener(InstanceListener listener)
Add a new listener interested in InstanceEvents.void
addMapping(String mapping)
Add a mapping associated with theWrapper
.void
addSecurityReference(String name, String link)
Add a new security role reference record to the set of records for this servlet.void
addValve(GlassFishValve valve)
Add a new Valve to the end of the pipeline associated with this Container.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.Wrapper
findMappingObject()
FIXME: Fooling introspection ...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.int
getClassLoadTime()
Gets how long it took for the servlet class to be loaded.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 implementSingleThreadModel
.int
getDebug()
Return the debugging detail level for this component.String
getDescription()
Gets the description of this servlet.String
getEngineName()
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 returnnull
.Enumeration<String>
getInitParameterNames()
Return the set of initialization parameter names defined for this servlet.Map<String,String>
getInitParameters()
InstanceSupport
getInstanceSupport()
Return the InstanceSupport object for this Wrapper instance.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).String
getLoadOnStartupString()
long
getLoadTime()
Gets how long it took for the servlet to be loaded.Collection<String>
getMappings()
Gets all the mapping associated with theWrapper
.int
getMaxInstances()
Return maximum number of instances that will be allocated when a single thread model servlet is used.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-Sizestatic Throwable
getRootCause(jakarta.servlet.ServletException e)
Extract the root cause from a servlet exception.String
getRunAs()
Return the run-as identity for this servlet.jakarta.servlet.Servlet
getServlet()
Class<? extends jakarta.servlet.Servlet>
getServletClass()
String
getServletClassName()
Return the fully qualified servlet class name for this servlet.jakarta.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.boolean
isAsyncSupported()
Checks if the wrapped servlet has been annotated or flagged in the deployment descriptor as being able to support asynchronous operations.boolean
isEventProvider()
boolean
isMultipartConfigured()
protected boolean
isOSGi()
Returns whether this is running in an OSGi contextboolean
isStateManageable()
boolean
isStatisticsProvider()
boolean
isUnavailable()
Is this servlet currently unavailable?void
load()
Loads and initializes an instance of the servlet, if there is not already at least one initialized instance.protected String
logName()
Log the abbreviated name of this Container for logging messages.protected void
registerJMX(StandardContext ctx)
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
sendNotification(Notification notification)
Sends a notification to anything listening via JMX.void
setAvailable(long available)
Set the available date/time for this servlet, in milliseconds since the epoch.void
setDebug(int debug)
Set the debugging detail level for this component.void
setDescription(String description)
Sets the description of this servlet.boolean
setInitParameter(String name, String value, boolean override)
Sets the init parameter with the given name and value on this servlet.Set<String>
setInitParameters(Map<String,String> initParameters)
Sets the initialization parameters contained in the given map on this servlet.void
setIsAsyncSupported(boolean isAsyncSupported)
Marks the wrapped servlet as supporting async operations or not.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
setLoadOnStartupString(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
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-sizeprotected void
setOSGi(boolean osgi)
Set whether this is being used in an OSGi contextvoid
setParent(Container container)
Set the parent Container of this Wrapper, but only if it is a Context.void
setRunAs(String runAs)
Set the run-as identity for this servlet.void
setServlet(jakarta.servlet.Servlet instance)
Sets the servlet instance for this wrapper.void
setServletClass(Class<? extends jakarta.servlet.Servlet> clazz)
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
setServletName(String name)
Set the name of this 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.String
toString()
Return a String representation of this component.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 class org.apache.catalina.core.ContainerBase
addContainerListener, addLifecycleListener, addPropertyChangeListener, addValve, backgroundProcess, createObjectName, destroy, findChild, findChildren, findContainerListeners, findLifecycleListeners, fireContainerEvent, getBackgroundProcessorDelay, getBasic, getChildren, getContainerSuffix, getDomain, getJmxName, getLoader, getLogger, getManager, getMappingObject, getName, getObjectName, getParent, getParentClassLoader, getParentName, getPipeline, getRealm, getResources, getValveObjectNames, getValves, hasCustomPipeline, hasNonBasicValves, init, invoke, isCheckIfRequestIsSecure, log, log, removeChild, removeContainerListener, removeLifecycleListener, removeLifecycleListeners, removePropertyChangeListener, removeValve, setBackgroundProcessorDelay, setBasic, setCheckIfRequestIsSecure, setDomain, setLoader, setLogger, setManager, setName, setParentClassLoader, setRealm, setResources, startChildren, 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, backgroundProcess, findChild, findChildren, findContainerListeners, fireContainerEvent, getBackgroundProcessorDelay, getLoader, getLogger, getManager, getMappingObject, getName, getParent, getParentClassLoader, getPipeline, getRealm, getResources, hasCustomPipeline, invoke, isCheckIfRequestIsSecure, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCheckIfRequestIsSecure, setLoader, setLogger, setManager, setName, setParentClassLoader, setRealm, setResources
-
-
-
-
Method Detail
-
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 interfaceWrapper
- Returns:
-
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 interfaceWrapper
- 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 implementSingleThreadModel
.- Returns:
-
getDebug
public int getDebug()
Return the debugging detail level for this component.- Overrides:
getDebug
in classContainerBase
- Returns:
-
setDebug
public void setDebug(int debug)
Set the debugging detail level for this component.- Overrides:
setDebug
in classContainerBase
- Parameters:
debug
- The new debugging detail level
-
getEngineName
public String getEngineName()
-
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 interfaceContainer
- Overrides:
getInfo
in classContainerBase
- Returns:
-
getInstanceSupport
public InstanceSupport getInstanceSupport()
Return the InstanceSupport object for this Wrapper instance.- Returns:
-
getJspFile
public String getJspFile()
Return the context-relative URI of the JSP file for this servlet.- Specified by:
getJspFile
in interfaceWrapper
- Returns:
-
setJspFile
public void setJspFile(String jspFile)
Set the context-relative URI of the JSP file for this servlet.- Specified by:
setJspFile
in interfaceWrapper
- 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 interfaceWrapper
- Returns:
-
setLoadOnStartup
public void setLoadOnStartup(int value)
Set the load-on-startup order value (negative value means load on first call).- Specified by:
setLoadOnStartup
in interfaceWrapper
- 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()
-
setDescription
public void setDescription(String description)
Sets the description of this servlet.- Specified by:
setDescription
in interfaceWrapper
- Parameters:
description
-
-
getDescription
public String getDescription()
Gets the description of this servlet.- Specified by:
getDescription
in interfaceWrapper
- Returns:
-
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 interfaceContainer
- Overrides:
setParent
in classContainerBase
- Parameters:
container
- Proposed parent Container
-
getRunAs
public String getRunAs()
Return the run-as identity for this servlet.
-
setRunAs
public void setRunAs(String runAs)
Set the run-as identity for this servlet.
-
setIsAsyncSupported
public void setIsAsyncSupported(boolean isAsyncSupported)
Marks the wrapped servlet as supporting async operations or not.- Specified by:
setIsAsyncSupported
in interfaceWrapper
- Parameters:
isAsyncSupported
- true if the wrapped servlet supports async mode, false otherwise
-
isAsyncSupported
public boolean isAsyncSupported()
Checks if the wrapped servlet has been annotated or flagged in the deployment descriptor as being able to support asynchronous operations.- Specified by:
isAsyncSupported
in interfaceWrapper
- Returns:
- true if the wrapped servlet supports async operations, and false otherwise
-
getServletClassName
public String getServletClassName()
Return the fully qualified servlet class name for this servlet.- Specified by:
getServletClassName
in interfaceWrapper
- Returns:
-
setServletClassName
public void setServletClassName(String className)
Set the fully qualified servlet class name for this servlet.- Specified by:
setServletClassName
in interfaceWrapper
- Parameters:
className
- Servlet class name
-
getServletClass
public Class<? extends jakarta.servlet.Servlet> getServletClass()
- Returns:
- the servlet class, or null if the servlet class has not been loaded yet
-
setServletClass
public void setServletClass(Class<? extends jakarta.servlet.Servlet> clazz)
Sets the class object from which this servlet will be instantiated.- Specified by:
setServletClass
in interfaceWrapper
- Parameters:
clazz
- The class object from which this servlet will be instantiated
-
getServlet
public jakarta.servlet.Servlet getServlet()
- Returns:
- the servlet instance, or null if the servlet has not yet been instantiated
-
setServlet
public void setServlet(jakarta.servlet.Servlet instance)
Sets the servlet instance for this wrapper.- Parameters:
instance
- the servlet instance
-
setServletName
public void setServletName(String name)
Set the name of this servlet. This is an alias for the normalContainer.setName()
method, and complements thegetServletName()
method required by theServletConfig
interface.- Parameters:
name
- The new name of this servlet
-
isUnavailable
public boolean isUnavailable()
Is this servlet currently unavailable?- Specified by:
isUnavailable
in interfaceWrapper
- Returns:
-
getServletMethods
public 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.- Specified by:
getServletMethods
in interfaceWrapper
- Returns:
- Array of names of the methods supported by the underlying servlet
- Throws:
jakarta.servlet.ServletException
-
isMultipartConfigured
public boolean isMultipartConfigured()
-
setMultipartLocation
public void setMultipartLocation(String location)
Sets the multipart location- Specified by:
setMultipartLocation
in interfaceWrapper
- Parameters:
location
-
-
getMultipartLocation
public String getMultipartLocation()
Gets the multipart location- Specified by:
getMultipartLocation
in interfaceWrapper
- Returns:
-
setMultipartMaxFileSize
public void setMultipartMaxFileSize(long maxFileSize)
Sets the multipart max-file-size- Specified by:
setMultipartMaxFileSize
in interfaceWrapper
- Parameters:
maxFileSize
-
-
getMultipartMaxFileSize
public long getMultipartMaxFileSize()
Gets the multipart max-file-size- Specified by:
getMultipartMaxFileSize
in interfaceWrapper
- Returns:
-
setMultipartMaxRequestSize
public void setMultipartMaxRequestSize(long maxRequestSize)
Sets the multipart max-request-size- Specified by:
setMultipartMaxRequestSize
in interfaceWrapper
- Parameters:
maxRequestSize
-
-
getMultipartMaxRequestSize
public long getMultipartMaxRequestSize()
Gets the multipart max-request-Size- Specified by:
getMultipartMaxRequestSize
in interfaceWrapper
- Returns:
-
setMultipartFileSizeThreshold
public void setMultipartFileSizeThreshold(int fileSizeThreshold)
Sets the multipart file-size-threshold- Specified by:
setMultipartFileSizeThreshold
in interfaceWrapper
- Parameters:
fileSizeThreshold
-
-
getMultipartFileSizeThreshold
public int getMultipartFileSizeThreshold()
Gets the multipart file-size-threshol- Specified by:
getMultipartFileSizeThreshold
in interfaceWrapper
- Returns:
-
isOSGi
protected boolean isOSGi()
Returns whether this is running in an OSGi context- Returns:
-
setOSGi
protected void setOSGi(boolean osgi)
Set whether this is being used in an OSGi context- Parameters:
osgi
-
-
addValve
public void addValve(GlassFishValve valve)
Description copied from class:ContainerBase
Add a new Valve to the end of the pipeline associated with this Container. Prior to adding the Valve, the Valve'ssetContainer
method must be called, with this Container as an argument. The method may throw anIllegalArgumentException
if this Valve chooses not to be associated with this Container, orIllegalStateException
if it is already associated with a different Container.- Specified by:
addValve
in interfacePipeline
- Overrides:
addValve
in classContainerBase
- Parameters:
valve
- Valve to be added
-
getRootCause
public static Throwable getRootCause(jakarta.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 interfaceContainer
- Overrides:
addChild
in classContainerBase
- Parameters:
child
- Child container to be added
-
addInitParameter
public void addInitParameter(String name, String value)
Adds the initialization parameter with the given name and value to this servlet.- Specified by:
addInitParameter
in interfaceWrapper
- Parameters:
name
- the name of the init parametervalue
- the value of the init parameter
-
setInitParameter
public boolean setInitParameter(String name, String value, boolean override)
Sets the init parameter with the given name and value on this servlet.- Parameters:
name
- the init parameter namevalue
- the init parameter valueoverride
- true if the given init param is supposed to override an existing init param with the same name, and false otherwise- Returns:
- true if the init parameter with the given name and value was set, false otherwise
-
setInitParameters
public Set<String> setInitParameters(Map<String,String> initParameters)
Sets the initialization parameters contained in the given map on this servlet.- Parameters:
initParameters
- the map with the init params to set- Returns:
- the (possibly empty) Set of initialization parameter names that are in conflict
-
addInstanceListener
public void addInstanceListener(InstanceListener listener)
Add a new listener interested in InstanceEvents.- Specified by:
addInstanceListener
in interfaceWrapper
- Parameters:
listener
- The new listener
-
addMapping
public void addMapping(String mapping)
Add a mapping associated with theWrapper
.- Specified by:
addMapping
in interfaceWrapper
- Parameters:
mapping
- The new wrapper mapping
-
getMappings
public Collection<String> getMappings()
Gets all the mapping associated with theWrapper
.- Returns:
- an unmodifiable list
-
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 interfaceWrapper
- Parameters:
name
- Role name used within this servletlink
- Role name used within the web application
-
allocate
public 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()
.
-
deallocate
public 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.- Specified by:
deallocate
in interfaceWrapper
- Parameters:
servlet
- The servlet to be returned- Throws:
jakarta.servlet.ServletException
- if a deallocation error occurs
-
findInitParameter
public String findInitParameter(String name)
Return the value for the specified initialization parameter name, if any; otherwise returnnull
.- Specified by:
findInitParameter
in interfaceWrapper
- Parameters:
name
- Name of the requested initialization parameter- Returns:
-
findInitParameters
public String[] findInitParameters()
Return the names of all defined initialization parameters for this servlet.- Specified by:
findInitParameters
in interfaceWrapper
- Returns:
-
findMappings
public String[] findMappings()
Return the mappings associated with this wrapper.- Specified by:
findMappings
in interfaceWrapper
- Returns:
-
findSecurityReference
public String findSecurityReference(String name)
Return the security role link for the specified security role reference name, if any; otherwise returnnull
.- Specified by:
findSecurityReference
in interfaceWrapper
- Parameters:
name
- Security role reference used within this servlet- Returns:
-
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 interfaceWrapper
- Returns:
-
findMappingObject
public Wrapper findMappingObject()
FIXME: Fooling introspection ...- Returns:
-
load
public void load() throws jakarta.servlet.ServletException
Loads and initializes an instance of the 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.
-
removeInitParameter
public void removeInitParameter(String name)
Remove the specified initialization parameter from this servlet.- Specified by:
removeInitParameter
in interfaceWrapper
- 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 interfaceWrapper
- Parameters:
listener
- The listener to remove
-
removeMapping
public void removeMapping(String mapping)
Remove a mapping associated with the wrapper.- Specified by:
removeMapping
in interfaceWrapper
- 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 interfaceWrapper
- Parameters:
name
- Security role used within this servlet to be removed
-
toString
public String toString()
Return a String representation of this component.
-
unavailable
public void unavailable(jakarta.servlet.UnavailableException unavailable)
Process an UnavailableException, marking this servlet as unavailable for the specified amount of time.- Specified by:
unavailable
in interfaceWrapper
- Parameters:
unavailable
- The exception that occurred, ornull
to mark this servlet as permanently unavailable
-
unload
public 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.
-
getInitParameter
public String getInitParameter(String name)
Return the initialization parameter value for the specified name, if any; otherwise returnnull
.- Specified by:
getInitParameter
in interfacejakarta.servlet.ServletConfig
- Parameters:
name
- Name of the initialization parameter to retrieve
-
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 interfacejakarta.servlet.ServletConfig
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()
Return the servlet context with which this servlet is associated.- Specified by:
getServletContext
in interfacejakarta.servlet.ServletConfig
-
getServletName
public String getServletName()
Return the name of this servlet.- Specified by:
getServletName
in interfacejakarta.servlet.ServletConfig
- Specified by:
getServletName
in interfaceWrapper
-
getLoadTime
public long getLoadTime()
Gets how long it took for the servlet to be loaded.- Returns:
- length in milliseconds
-
setLoadTime
public void setLoadTime(long loadTime)
-
getClassLoadTime
public int getClassLoadTime()
Gets how long it took for the servlet class to be loaded.- Returns:
- length in milliseconds
-
addDefaultMapper
protected void addDefaultMapper(String mapperClass)
Add a default Mapper implementation if none have been configured explicitly.- Parameters:
mapperClass
- Java class name of the default Mapper
-
logName
protected String logName()
Log the abbreviated name of this Container for logging messages.- Overrides:
logName
in classContainerBase
- Returns:
StandardWrapper[<parentName | null> : nameOfContainer]
-
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 interfaceLifecycle
- Overrides:
start
in classContainerBase
- 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 interfaceLifecycle
- Overrides:
stop
in classContainerBase
- Throws:
LifecycleException
- if a fatal error occurs during shutdown
-
registerJMX
protected void registerJMX(StandardContext ctx)
-
sendNotification
public void sendNotification(Notification notification)
Sends a notification to anything listening via JMX.This function does not have anything to do with the notification service in Payara.
- Parameters:
notification
-- See Also:
NotificationBroadcasterSupport
,NotificationService
-
isEventProvider
public boolean isEventProvider()
- Returns:
- false
-
isStateManageable
public boolean isStateManageable()
- Returns:
- false
-
isStatisticsProvider
public boolean isStatisticsProvider()
- Returns:
- false
-
-