public class StandardWrapper extends ContainerBase implements javax.servlet.ServletConfig, Wrapper, NotificationEmitter
ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild| Modifier and Type | Field and Description |
|---|---|
protected boolean |
asyncSupported
Async supported flag.
|
protected long |
available
The date and time at which this servlet will become available (in
milliseconds since the epoch), or zero if the servlet is available.
|
protected 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
Static class array used when the SecurityManager is turned on and
Servlet.service is invoked. |
protected int |
countAllocated
The count of allocations that are currently active for STM servlets.
|
protected static String[] |
DEFAULT_SERVLET_METHODS |
protected String |
description
Description.
|
protected boolean |
dynamic
Dynamic flag.
|
protected boolean |
enabled
Enabled flag.
|
protected StandardWrapperFacade |
facade
The facade associated with this wrapper.
|
protected static String |
info
The descriptive information string for this implementation.
|
protected javax.servlet.Servlet |
instance
The (single) initialized instance of this servlet.
|
protected Stack |
instancePool
Stack containing the STM instances.
|
protected InstanceSupport |
instanceSupport
The support object for our instance listeners.
|
protected boolean |
isJspServlet
True if this StandardWrapper is for the JspServlet
|
protected String |
jspFile
The context-relative URI of the JSP file for this servlet.
|
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 |
mappings
Mappings associated with the wrapper.
|
protected int |
maxInstances
Maximum number of STM instances.
|
protected Multipart |
multipartConfig
The multipart config annotation configured on this servlet.
|
protected int |
nInstances
Number of instances currently loaded for a STM servlet.
|
protected MBeanNotificationInfo[] |
notificationInfo |
protected HashMap |
parameters
The initialization parameters for this servlet, keyed by
parameter name.
|
protected HashMap |
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 javax.servlet.Servlet |
servletInstance
The (single) initialized instance of this servlet.
|
protected javax.servlet.ServletSecurityElement |
servletSecurity
Associated ServletSecurity.
|
protected boolean |
singleThreadModel
Does this servlet implement the SingleThreadModel interface?
|
protected 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?
|
backgroundProcessorDelay, children, cluster, CONTAINER_ARRAY, controller, domain, initialized, lifecycle, LISTENER_ARRAY, listeners, loader, logger, logName, manager, mserver, name, oname, parent, parentClassLoader, pipeline, realm, resources, startChildren, started, suffix, support, typeADD_CHILD_EVENT, ADD_MAPPER_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_MAPPER_EVENT, REMOVE_VALVE_EVENTAFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT| Constructor and Description |
|---|
StandardWrapper()
Create a new StandardWrapper component with the default basic Valve.
|
| 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.
|
protected void |
addDefaultMapper(String mapperClass)
Add a default Mapper implementation if none have been configured
explicitly.
|
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.
|
javax.servlet.Servlet |
allocate()
Allocate an initialized instance of this Servlet that is ready to have
its
service() method called. |
void |
backgroundProcess()
Execute a periodic task, such as reloading, etc.
|
void |
deallocate(javax.servlet.Servlet servlet)
Return this previously allocated servlet to the pool of available
instances.
|
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()
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 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) |
boolean |
getAsyncSupported()
Return the async supported value.
|
long |
getAvailable()
Return the available date/time for this servlet, in milliseconds since
the epoch.
|
int |
getClassLoadTime() |
int |
getCountAllocated()
Return the number of active allocations of this servlet.
|
String |
getDescription()
Return the Servlet description.
|
boolean |
getEnabled()
Return the enabled value.
|
String |
getEngineName() |
int |
getErrorCount() |
javax.servlet.ServletRegistration |
getFacade()
Get the facade ServletRegistration.
|
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 |
getInitParameterNames()
Return the set of initialization parameter names defined for this
servlet.
|
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() |
int |
getMaxInstances()
Return maximum number of instances that will be allocated when a single
thread model servlet is used.
|
long |
getMaxTime() |
long |
getMinTime() |
Multipart |
getMultipartConfig()
Multipart configuration for this Servlet.
|
MBeanNotificationInfo[] |
getNotificationInfo() |
long |
getProcessingTime() |
int |
getRequestCount() |
static Throwable |
getRootCause(javax.servlet.ServletException e)
Extract the root cause from a servlet exception.
|
String |
getRunAs()
Return the run-as identity for this servlet.
|
javax.servlet.Servlet |
getServlet()
Return the associated servlet instance.
|
String |
getServletClass()
Return the fully qualified servlet class name for this servlet.
|
javax.servlet.ServletContext |
getServletContext()
Return the servlet context with which this servlet is associated.
|
String[] |
getServletMethods()
Gets the names of the methods supported by the underlying servlet.
|
String |
getServletName()
Return the name of this servlet.
|
javax.servlet.ServletSecurityElement |
getServletSecurity()
Get an associated ServletSecurity, if any.
|
void |
incrementErrorCount()
Increment the error count used for monitoring.
|
protected boolean |
isContainerProvidedServlet(String classname)
Return
true if the specified class name represents a
container provided servlet class that should be loaded by the
server class loader. |
boolean |
isDynamic()
Get the flag that indicates if the wrapper was added programmatically.
|
boolean |
isEventProvider() |
boolean |
isSingleThreadModel()
Return
true if the servlet class represented by this
component implements the SingleThreadModel interface. |
boolean |
isStateManageable() |
boolean |
isStatisticsProvider() |
boolean |
isUnavailable()
Is this servlet currently unavailable?
|
void |
load()
Load and initialize an instance of this servlet, if there is not already
at least one initialized instance.
|
javax.servlet.Servlet |
loadServlet()
Load and initialize an instance of this servlet, if there is not already
at least one initialized instance.
|
protected void |
registerJMX(StandardContext ctx) |
void |
removeInitParameter(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 |
setAsyncSupported(boolean value)
Set the async supported value.
|
void |
setAvailable(long available)
Set the available date/time for this servlet, in milliseconds since the
epoch.
|
void |
setDescription(String description)
Set the description.
|
void |
setDynamic(boolean dynamic)
Set a flag that indicates if the wrapper was added programmatically.
|
void |
setEnabled(boolean value)
Set the enabled value.
|
void |
setErrorCount(int errorCount) |
void |
setJspFile(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 |
setMaxTime(long maxTime) |
void |
setMinTime(long minTime) |
void |
setMultipartConfig(Multipart multipartConfig)
Set the multipart configuration for this Servlet.
|
void |
setParent(Container container)
Set the parent Container of this Wrapper, but only if it is a Context.
|
void |
setProcessingTime(long processingTime) |
void |
setRequestCount(int requestCount) |
void |
setRunAs(String runAs)
Set the run-as identity for this servlet.
|
void |
setServlet(javax.servlet.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.
|
Set<String> |
setServletSecurity(javax.servlet.ServletSecurityElement servletSecurity)
Set an associated ServletSecurity on mappings which are currently associated
with the Servlet.
|
void |
start()
Start this component, pre-loading the servlet if the load-on-startup
value is set appropriately.
|
void |
stop()
Stop this component, gracefully shutting down the servlet if it has
been initialized.
|
String |
toString()
Return a String representation of this component.
|
void |
unavailable(javax.servlet.UnavailableException unavailable)
Process an UnavailableException, marking this servlet as unavailable
for the specified amount of time.
|
void |
unload()
Unload all initialized instances of this servlet, after calling the
destroy() method for each instance. |
addContainerListener, addLifecycleListener, addPropertyChangeListener, addValve, createObjectName, destroy, findChild, findChildren, findContainerListeners, findLifecycleListeners, fireContainerEvent, getBackgroundProcessorDelay, getBasic, getChildren, getCluster, getContainerSuffix, getDomain, getFirst, getJmxName, getJSR77Suffix, getLoader, getLogger, getManager, getMappingObject, getName, getObjectName, getParent, getParentClassLoader, getParentName, getPipeline, getRealm, getResources, getStartChildren, getType, getValveObjectNames, getValves, init, invoke, isStarted, logName, postDeregister, postRegister, preDeregister, preRegister, removeChild, removeContainerListener, removeLifecycleListener, removePropertyChangeListener, removeValve, setBackgroundProcessorDelay, setBasic, setCluster, setDomain, setLoader, setManager, setName, setParentClassLoader, setRealm, setResources, setStartChildren, threadStart, threadStopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddContainerListener, addPropertyChangeListener, findChild, findChildren, findContainerListeners, fireContainerEvent, getBackgroundProcessorDelay, getCluster, getLoader, getLogger, getManager, getMappingObject, getName, getObjectName, getParent, getParentClassLoader, getPipeline, getRealm, getResources, invoke, isStarted, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setLoader, setManager, setName, setParentClassLoader, setRealm, setResourcesprotected static final String[] DEFAULT_SERVLET_METHODS
protected boolean asyncSupported
protected boolean dynamic
protected boolean enabled
protected long available
protected NotificationBroadcasterSupport broadcaster
protected int countAllocated
protected String description
protected StandardWrapperFacade facade
protected static final String info
protected javax.servlet.Servlet instance
protected javax.servlet.Servlet servletInstance
protected InstanceSupport instanceSupport
protected String jspFile
protected int loadOnStartup
protected Multipart multipartConfig
protected ArrayList mappings
protected HashMap parameters
protected HashMap references
protected String runAs
protected javax.servlet.ServletSecurityElement servletSecurity
protected long sequenceNumber
protected String servletClass
protected boolean singleThreadModel
protected boolean unloading
protected int maxInstances
protected int nInstances
protected Stack instancePool
protected long unloadDelay
protected boolean isJspServlet
protected ObjectName jspMonitorON
protected org.apache.catalina.core.StandardWrapperValve swValve
protected long loadTime
protected int classLoadTime
protected static Class[] classType
Servlet.init is invoked.protected static Class[] classTypeUsedInService
Servlet.service is invoked.protected MBeanNotificationInfo[] notificationInfo
public StandardWrapper()
public boolean getAsyncSupported()
getAsyncSupported in interface Wrapperpublic void setAsyncSupported(boolean value)
setAsyncSupported in interface Wrappervalue - New async supported valuepublic String getDescription()
getDescription in interface Wrapperpublic void setDescription(String description)
setDescription in interface Wrapperpublic boolean isDynamic()
Wrapperpublic void setDynamic(boolean dynamic)
WrappersetDynamic in interface Wrapperpublic boolean getEnabled()
getEnabled in interface Wrapperpublic void setEnabled(boolean value)
setEnabled in interface Wrappervalue - New enabled valuepublic long getAvailable()
getAvailable in interface Wrapperpublic void setAvailable(long available)
setAvailable in interface Wrapperavailable - The new available date/timepublic int getCountAllocated()
public String getEngineName()
public String getInfo()
<description>/<version>.getInfo in interface ContainergetInfo in class ContainerBasepublic InstanceSupport getInstanceSupport()
getInstanceSupport in interface Wrapperpublic String getJspFile()
getJspFile in interface Wrapperpublic void setJspFile(String jspFile)
setJspFile in interface WrapperjspFile - JSP file URIpublic int getLoadOnStartup()
getLoadOnStartup in interface Wrapperpublic void setLoadOnStartup(int value)
setLoadOnStartup in interface Wrappervalue - New load-on-startup valuepublic void setLoadOnStartupString(String value)
value - New load-on-startup valuepublic String getLoadOnStartupString()
public Multipart getMultipartConfig()
getMultipartConfig in interface Wrapperpublic void setMultipartConfig(Multipart multipartConfig)
setMultipartConfig in interface Wrapperpublic int getMaxInstances()
public void setMaxInstances(int maxInstances)
maxInstances - New value of maxInstancespublic void setParent(Container container)
setParent in interface ContainersetParent in class ContainerBasecontainer - Proposed parent Containerpublic String getRunAs()
public void setRunAs(String runAs)
public javax.servlet.ServletSecurityElement getServletSecurity()
getServletSecurity in interface Wrapperpublic Set<String> setServletSecurity(javax.servlet.ServletSecurityElement servletSecurity)
setServletSecurity in interface Wrapperpublic String getServletClass()
getServletClass in interface Wrapperpublic void setServletClass(String servletClass)
setServletClass in interface WrapperservletClass - Servlet class namepublic void setServletName(String name)
Container.setName() method, and complements the
getServletName() method required by the
ServletConfig interface.name - The new name of this servletpublic boolean isSingleThreadModel()
true if the servlet class represented by this
component implements the SingleThreadModel interface.public boolean isUnavailable()
isUnavailable in interface Wrapperpublic javax.servlet.ServletRegistration getFacade()
public String[] getServletMethods() throws javax.servlet.ServletException
getServletMethods in interface Wrapperjavax.servlet.ServletExceptionpublic void backgroundProcess()
backgroundProcess in interface ContainerbackgroundProcess in class ContainerBasepublic static Throwable getRootCause(javax.servlet.ServletException e)
e - The servlet exceptionpublic void addChild(Container child)
addChild in interface ContaineraddChild in class ContainerBasechild - Child container to be addedpublic void addInitParameter(String name, String value)
addInitParameter in interface Wrappername - Name of this initialization parameter to addvalue - Value of this initialization parameter to addpublic void addInstanceListener(InstanceListener listener)
addInstanceListener in interface Wrapperlistener - The new listenerpublic void addMapping(String mapping)
addMapping in interface Wrappermapping - The new wrapper mappingpublic void addSecurityReference(String name, String link)
addSecurityReference in interface Wrappername - Role name used within this servletlink - Role name used within the web applicationpublic javax.servlet.Servlet getServlet()
getServlet in interface Wrapperpublic void setServlet(javax.servlet.Servlet servlet)
setServlet in interface Wrapperpublic javax.servlet.Servlet allocate()
throws javax.servlet.ServletException
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().public void deallocate(javax.servlet.Servlet servlet)
throws javax.servlet.ServletException
deallocate in interface Wrapperservlet - The servlet to be returnedjavax.servlet.ServletException - if a deallocation error occurspublic String findInitParameter(String name)
null.findInitParameter in interface Wrappername - Name of the requested initialization parameterpublic String[] findInitParameters()
findInitParameters in interface Wrapperpublic String[] findMappings()
findMappings in interface Wrapperpublic String findSecurityReference(String name)
null.findSecurityReference in interface Wrappername - Security role reference used within this servletpublic String[] findSecurityReferences()
findSecurityReferences in interface Wrapperpublic Wrapper findMappingObject()
public void load()
throws javax.servlet.ServletException
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.
public javax.servlet.Servlet loadServlet()
throws javax.servlet.ServletException
javax.servlet.ServletExceptionpublic void removeInitParameter(String name)
removeInitParameter in interface Wrappername - Name of the initialization parameter to removepublic void removeInstanceListener(InstanceListener listener)
removeInstanceListener in interface Wrapperlistener - The listener to removepublic void removeMapping(String mapping)
removeMapping in interface Wrappermapping - The pattern to removepublic void removeSecurityReference(String name)
removeSecurityReference in interface Wrappername - Security role used within this servlet to be removedpublic String toString()
public void unavailable(javax.servlet.UnavailableException unavailable)
unavailable in interface Wrapperunavailable - The exception that occurred, or null
to mark this servlet as permanently unavailablepublic void unload()
throws javax.servlet.ServletException
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.public String getInitParameter(String name)
null.getInitParameter in interface javax.servlet.ServletConfigname - Name of the initialization parameter to retrievepublic Enumeration getInitParameterNames()
getInitParameterNames in interface javax.servlet.ServletConfigpublic javax.servlet.ServletContext getServletContext()
getServletContext in interface javax.servlet.ServletConfigpublic String getServletName()
getServletName in interface javax.servlet.ServletConfigpublic long getProcessingTime()
public void setProcessingTime(long processingTime)
public long getMaxTime()
public void setMaxTime(long maxTime)
public long getMinTime()
public void setMinTime(long minTime)
public int getRequestCount()
public void setRequestCount(int requestCount)
public int getErrorCount()
public void setErrorCount(int errorCount)
public void incrementErrorCount()
incrementErrorCount in interface Wrapperpublic long getLoadTime()
public void setLoadTime(long loadTime)
public int getClassLoadTime()
protected void addDefaultMapper(String mapperClass)
mapperClass - Java class name of the default Mapperprotected boolean isContainerProvidedServlet(String classname)
true if the specified class name represents a
container provided servlet class that should be loaded by the
server class loader.classname - Name of the class to be checkedpublic void start()
throws LifecycleException
start in interface Lifecyclestart in class ContainerBaseLifecycleException - if a fatal error occurs during startuppublic void stop()
throws LifecycleException
stop in interface Lifecyclestop in class ContainerBaseLifecycleException - if a fatal error occurs during shutdownprotected void registerJMX(StandardContext ctx)
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object object) throws ListenerNotFoundException
removeNotificationListener in interface NotificationEmitterListenerNotFoundExceptionpublic MBeanNotificationInfo[] getNotificationInfo()
getNotificationInfo in interface NotificationBroadcasterpublic void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object object) throws IllegalArgumentException
addNotificationListener in interface NotificationBroadcasterIllegalArgumentExceptionpublic void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
removeNotificationListener in interface NotificationBroadcasterListenerNotFoundExceptionNotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener)public boolean isEventProvider()
public boolean isStateManageable()
public boolean isStatisticsProvider()
Copyright © 2016 JBoss by Red Hat. All rights reserved.