org.apache.catalina.core
public class StandardWrapper extends ContainerBase implements ServletConfig, Wrapper, NotificationEmitter
Version: $Revision: 771014 $ $Date: 2009-05-03 03:33:01 +0200 (Sun, 03 May 2009) $
Field Summary | |
---|---|
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 AtomicInteger | countAllocated
The count of allocations that are currently active (even if they
are for the same instance, as will be true on a non-STM servlet). |
protected static String[] | DEFAULT_SERVLET_METHODS |
protected StandardWrapperFacade | facade
The facade associated with this wrapper. |
protected static String | info
The descriptive information string for this implementation. |
protected 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 static Log | log |
protected ArrayList | mappings
Mappings associated with the wrapper. |
protected int | maxInstances
Maximum number of STM instances. |
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 static Properties | restrictedServlets
Restricted servlets (which can only be loaded by a privileged webapp). |
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 boolean | singleThreadModel
Does this servlet implement the SingleThreadModel interface? |
protected boolean | swallowOutput
Should we swallow System.out |
protected StandardWrapperValve | swValve |
protected long | unloadDelay
Wait time for servlet unload in ms. |
protected boolean | unloading
Are we unloading our servlet instance at the moment? |
Constructor Summary | |
---|---|
StandardWrapper()
Create a new StandardWrapper component with the default basic Valve. |
Method Summary | |
---|---|
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.
|
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(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) |
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, even if they
are all for the same instance (as will be true for servlets that do
not implement SingleThreadModel . |
String | getEngineName() |
int | getErrorCount() |
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() |
MBeanNotificationInfo[] | getNotificationInfo() |
long | getProcessingTime() |
int | getRequestCount() |
static Throwable | getRootCause(ServletException e)
Extract the root cause from a servlet exception.
|
String | getRunAs()
Return the run-as identity for this servlet. |
Servlet | getServlet()
Return the associated servlet instance. |
String | getServletClass()
Return the fully qualified servlet class name for this 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. |
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 | isEventProvider() |
protected boolean | isServletAllowed(Object servlet)
Return true if loading this servlet is allowed. |
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. |
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, NotificationFilter filter, Object object) |
void | removeNotificationListener(NotificationListener listener)
Remove a JMX-NotificationListener |
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 | 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 | 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 | setServletClass(String servletClass)
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(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. |
Servlet.init
is invoked.Servlet.service
is invoked.Parameters: child Child container to be added
Parameters: mapperClass Java class name of the default Mapper
Parameters: name Name of this initialization parameter to add value Value of this initialization parameter to add
Parameters: listener The new listener
Parameters: mapping The new wrapper mapping
Parameters: name Role name used within this servlet link Role name used within the web application
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()
.
Throws: ServletException if the servlet init() method threw an exception ServletException if a loading error occurs
Parameters: servlet The servlet to be returned
Throws: ServletException if a deallocation error occurs
null
.
Parameters: name Name of the requested initialization parameter
null
.
Parameters: name Security role reference used within this servlet
SingleThreadModel
.<description>/<version>
.null
.
Parameters: name Name of the initialization parameter to retrieve
Parameters: e The servlet exception
Returns: Array of names of the methods supported by the underlying servlet
true
if the specified class name represents a
container provided servlet class that should be loaded by the
server class loader.
Parameters: classname Name of the class to be checked
true
if loading this servlet is allowed.true
if the servlet class represented by this
component implements the SingleThreadModel
interface.
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.
Throws: ServletException if the servlet init() method threw an exception ServletException if some other loading problem occurs
Parameters: name Name of the initialization parameter to remove
Parameters: listener The listener to remove
Parameters: mapping The pattern to remove
See Also: javax.management.NotificationBroadcaster#removeNotificationListener(javax.management.NotificationListener)
Parameters: name Security role used within this servlet to be removed
Parameters: available The new available date/time
Parameters: jspFile JSP file URI
Parameters: value New load-on-startup value
Parameters: value New load-on-startup value
Parameters: maxInstances New value of maxInstances
Parameters: container Proposed parent Container
Parameters: runAs New run-as identity value
Parameters: servletClass Servlet class name
Container.setName()
method, and complements the
getServletName()
method required by the
ServletConfig
interface.
Parameters: name The new name of this servlet
Throws: LifecycleException if a fatal error occurs during startup
Throws: LifecycleException if a fatal error occurs during shutdown
Parameters: unavailable The exception that occurred, or null
to mark this servlet as permanently unavailable
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.
Throws: ServletException if an exception is thrown by the destroy() method