public class StandardWrapper extends ContainerBase implements javax.servlet.ServletConfig, Wrapper
ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild
Modifier and Type | Field and Description |
---|---|
protected boolean |
instanceInitialized
Flag that indicates if this instance has been initialized
|
protected long |
unloadDelay
Wait time for servlet unload in ms.
|
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
ADD_CHILD_EVENT, ADD_MAPPER_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_MAPPER_EVENT, REMOVE_VALVE_EVENT
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_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)
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 the
Wrapper . |
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.
|
javax.servlet.Servlet |
allocate()
Allocate an initialized instance of this Servlet that is ready to have
its
service() method called. |
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.
|
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 implement
SingleThreadModel . |
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 return
null . |
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 the
Wrapper . |
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-threshol
|
String |
getMultipartLocation()
Gets the multipart location
|
long |
getMultipartMaxFileSize()
Gets the multipart max-file-size
|
long |
getMultipartMaxRequestSize()
Gets the multipart max-request-Size
|
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() |
Class<? extends javax.servlet.Servlet> |
getServletClass() |
String |
getServletClassName()
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.
|
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 context
|
boolean |
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-threshold
|
void |
setMultipartLocation(String location)
Sets the multipart location
|
void |
setMultipartMaxFileSize(long maxFileSize)
Sets the multipart max-file-size
|
void |
setMultipartMaxRequestSize(long maxRequestSize)
Sets the multipart max-request-size
|
protected void |
setOSGi(boolean osgi)
Set whether this is being used in an OSGi context
|
void |
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(javax.servlet.Servlet instance)
Sets the servlet instance for this wrapper.
|
void |
setServletClass(Class<? extends javax.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(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, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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
protected volatile boolean instanceInitialized
protected long unloadDelay
public StandardWrapper()
public long getAvailable()
getAvailable
in interface Wrapper
public void setAvailable(long available)
setAvailable
in interface Wrapper
available
- The new available date/timepublic int getCountAllocated()
SingleThreadModel
.public int getDebug()
getDebug
in class ContainerBase
public void setDebug(int debug)
setDebug
in class ContainerBase
debug
- The new debugging detail levelpublic String getEngineName()
public String getInfo()
<description>/<version>
.getInfo
in interface Container
getInfo
in class ContainerBase
public InstanceSupport getInstanceSupport()
public String getJspFile()
getJspFile
in interface Wrapper
public void setJspFile(String jspFile)
setJspFile
in interface Wrapper
jspFile
- JSP file URIpublic int getLoadOnStartup()
getLoadOnStartup
in interface Wrapper
public void setLoadOnStartup(int value)
setLoadOnStartup
in interface Wrapper
value
- New load-on-startup valuepublic void setLoadOnStartupString(String value)
value
- New load-on-startup valuepublic String getLoadOnStartupString()
public void setDescription(String description)
setDescription
in interface Wrapper
description
- public String getDescription()
getDescription
in interface Wrapper
public int getMaxInstances()
public void setMaxInstances(int maxInstances)
maxInstances
- New value of maxInstancespublic void setParent(Container container)
setParent
in interface Container
setParent
in class ContainerBase
container
- Proposed parent Containerpublic String getRunAs()
public void setRunAs(String runAs)
public void setIsAsyncSupported(boolean isAsyncSupported)
setIsAsyncSupported
in interface Wrapper
isAsyncSupported
- true if the wrapped servlet supports async mode,
false otherwisepublic boolean isAsyncSupported()
isAsyncSupported
in interface Wrapper
public String getServletClassName()
getServletClassName
in interface Wrapper
public void setServletClassName(String className)
setServletClassName
in interface Wrapper
className
- Servlet class namepublic Class<? extends javax.servlet.Servlet> getServletClass()
public void setServletClass(Class<? extends javax.servlet.Servlet> clazz)
setServletClass
in interface Wrapper
clazz
- The class object from which this servlet will
be instantiatedpublic javax.servlet.Servlet getServlet()
public void setServlet(javax.servlet.Servlet instance)
instance
- the servlet instancepublic 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 isUnavailable()
isUnavailable
in interface Wrapper
public String[] getServletMethods() throws javax.servlet.ServletException
getServletMethods
in interface Wrapper
javax.servlet.ServletException
public boolean isMultipartConfigured()
public void setMultipartLocation(String location)
setMultipartLocation
in interface Wrapper
location
- public String getMultipartLocation()
getMultipartLocation
in interface Wrapper
public void setMultipartMaxFileSize(long maxFileSize)
setMultipartMaxFileSize
in interface Wrapper
maxFileSize
- public long getMultipartMaxFileSize()
getMultipartMaxFileSize
in interface Wrapper
public void setMultipartMaxRequestSize(long maxRequestSize)
setMultipartMaxRequestSize
in interface Wrapper
maxRequestSize
- public long getMultipartMaxRequestSize()
getMultipartMaxRequestSize
in interface Wrapper
public void setMultipartFileSizeThreshold(int fileSizeThreshold)
setMultipartFileSizeThreshold
in interface Wrapper
fileSizeThreshold
- public int getMultipartFileSizeThreshold()
getMultipartFileSizeThreshold
in interface Wrapper
protected boolean isOSGi()
protected void setOSGi(boolean osgi)
osgi
- public void addValve(GlassFishValve valve)
ContainerBase
setContainer
method must be called, with this Container
as an argument. The method may throw an
IllegalArgumentException
if this Valve chooses not to
be associated with this Container, or IllegalStateException
if it is already associated with a different Container.addValve
in interface Pipeline
addValve
in class ContainerBase
valve
- Valve to be addedpublic static Throwable getRootCause(javax.servlet.ServletException e)
e
- The servlet exceptionpublic void addChild(Container child)
addChild
in interface Container
addChild
in class ContainerBase
child
- Child container to be addedpublic void addInitParameter(String name, String value)
addInitParameter
in interface Wrapper
name
- the name of the init parametervalue
- the value of the init parameterpublic boolean setInitParameter(String name, String value, boolean override)
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
otherwisepublic Set<String> setInitParameters(Map<String,String> initParameters)
initParameters
- the map with the init params to setpublic void addInstanceListener(InstanceListener listener)
addInstanceListener
in interface Wrapper
listener
- The new listenerpublic void addMapping(String mapping)
Wrapper
.addMapping
in interface Wrapper
mapping
- The new wrapper mappingpublic Collection<String> getMappings()
Wrapper
.public void addSecurityReference(String name, String link)
addSecurityReference
in interface Wrapper
name
- Role name used within this servletlink
- Role name used within the web applicationpublic 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 Wrapper
servlet
- The servlet to be returnedjavax.servlet.ServletException
- if a deallocation error occurspublic String findInitParameter(String name)
null
.findInitParameter
in interface Wrapper
name
- Name of the requested initialization parameterpublic String[] findInitParameters()
findInitParameters
in interface Wrapper
public String[] findMappings()
findMappings
in interface Wrapper
public String findSecurityReference(String name)
null
.findSecurityReference
in interface Wrapper
name
- Security role reference used within this servletpublic String[] findSecurityReferences()
findSecurityReferences
in interface Wrapper
public 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 void removeInitParameter(String name)
removeInitParameter
in interface Wrapper
name
- Name of the initialization parameter to removepublic void removeInstanceListener(InstanceListener listener)
removeInstanceListener
in interface Wrapper
listener
- The listener to removepublic void removeMapping(String mapping)
removeMapping
in interface Wrapper
mapping
- The pattern to removepublic void removeSecurityReference(String name)
removeSecurityReference
in interface Wrapper
name
- Security role used within this servlet to be removedpublic String toString()
public void unavailable(javax.servlet.UnavailableException unavailable)
unavailable
in interface Wrapper
unavailable
- 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.ServletConfig
name
- Name of the initialization parameter to retrievepublic Enumeration<String> getInitParameterNames()
getInitParameterNames
in interface javax.servlet.ServletConfig
public javax.servlet.ServletContext getServletContext()
getServletContext
in interface javax.servlet.ServletConfig
public String getServletName()
getServletName
in interface javax.servlet.ServletConfig
getServletName
in interface Wrapper
public long getLoadTime()
public void setLoadTime(long loadTime)
public int getClassLoadTime()
protected void addDefaultMapper(String mapperClass)
mapperClass
- Java class name of the default Mapperprotected String logName()
logName
in class ContainerBase
StandardWrapper[<parentName | null> : nameOfContainer]
public void start() throws LifecycleException
start
in interface Lifecycle
start
in class ContainerBase
LifecycleException
- if a fatal error occurs during startuppublic void stop() throws LifecycleException
stop
in interface Lifecycle
stop
in class ContainerBase
LifecycleException
- if a fatal error occurs during shutdownprotected void registerJMX(StandardContext ctx)
public void sendNotification(Notification notification)
This function does not have anything to do with the notification service in Payara.
notification
- NotificationBroadcasterSupport
,
NotificationService
public boolean isEventProvider()
public boolean isStateManageable()
public boolean isStatisticsProvider()
Copyright © 2019. All rights reserved.