|
Apache Tomcat 6.0.53 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.catalina.core.ContainerBase
public abstract class ContainerBase
Abstract implementation of the Container interface, providing common
functionality required by nearly every implementation. Classes extending
this base class must implement getInfo(), and may implement
a replacement for invoke().
All subclasses of this abstract base class will include support for a
Pipeline object that defines the processing to be performed for each request
received by the invoke() method of this class, utilizing the
"Chain of Responsibility" design pattern. A subclass should encapsulate its
own processing functionality as a Valve, and configure this
Valve into the pipeline by calling setBasic().
This implementation fires property change events, per the JavaBeans design
pattern, for changes in singleton properties. In addition, it fires the
following ContainerEvent events to listeners who register
themselves with addContainerListener():
| Type | Data | Description |
|---|---|---|
addChild |
Container |
Child container added to this Container. |
addValve |
Valve |
Valve added to this Container. |
removeChild |
Container |
Child container removed from this Container. |
removeValve |
Valve |
Valve removed from this Container. |
start |
null |
Container was started. |
stop |
null |
Container was stopped. |
| Nested Class Summary | |
|---|---|
protected class |
ContainerBase.ContainerBackgroundProcessor
Private thread class to invoke the backgroundProcess method of this container and its children after a fixed delay. |
protected static class |
ContainerBase.NoopAccessLog
|
protected class |
ContainerBase.PrivilegedAddChild
Perform addChild with the permissions of this class. |
| Field Summary | |
|---|---|
protected AccessLog |
accessLog
The access log to use for requests normally handled by this container that have been handled earlier in the processing chain. |
protected int |
backgroundProcessorDelay
The processor delay for this component. |
protected java.util.HashMap |
children
The child Containers belonging to this Container, keyed by name. |
protected Cluster |
cluster
The cluster with which this Container is associated. |
protected javax.management.ObjectName |
controller
|
protected java.lang.String |
domain
|
protected boolean |
initialized
|
protected LifecycleSupport |
lifecycle
The lifecycle event support for this component. |
protected java.util.ArrayList |
listeners
The container event listeners for this Container. |
protected Loader |
loader
The Loader implementation with which this Container is associated. |
protected Log |
logger
The Logger implementation with which this Container is associated. |
protected java.lang.String |
logName
Associated logger name. |
protected Manager |
manager
The Manager implementation with which this Container is associated. |
protected javax.management.MBeanServer |
mserver
|
protected java.lang.String |
name
The human-readable name of this Container. |
protected javax.management.ObjectName |
oname
|
protected Container |
parent
The parent Container to which this Container is a child. |
protected java.lang.ClassLoader |
parentClassLoader
The parent class loader to be configured when we install a Loader. |
protected Pipeline |
pipeline
The Pipeline object with which this Container is associated. |
protected Realm |
realm
The Realm with which this Container is associated. |
protected javax.naming.directory.DirContext |
resources
The resources DirContext object with which this Container is associated. |
protected static StringManager |
sm
The string manager for this package. |
protected boolean |
startChildren
Will children be started automatically when they are added. |
protected boolean |
started
Has this component been started? |
protected java.lang.String |
suffix
|
protected java.beans.PropertyChangeSupport |
support
The property change support for this component. |
protected java.lang.String |
type
|
| 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, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
| Constructor Summary | |
|---|---|
ContainerBase()
|
|
| Method Summary | |
|---|---|
void |
addChild(Container child)
Add a new child Container to those associated with this Container, if supported. |
void |
addContainerListener(ContainerListener listener)
Add a container event listener to this component. |
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component. |
void |
addValve(Valve valve)
Add a new Valve to the end of the pipeline associated with this Container. |
void |
backgroundProcess()
Execute a periodic task, such as reloading, etc. |
javax.management.ObjectName |
createObjectName(java.lang.String domain,
javax.management.ObjectName parent)
|
void |
destroy()
|
Container |
findChild(java.lang.String name)
Return the child Container, associated with this Container, with the specified name (if any); otherwise, return null |
Container[] |
findChildren()
Return the set of children Containers associated with this Container. |
ContainerListener[] |
findContainerListeners()
Return the set of container listeners associated with this Container. |
LifecycleListener[] |
findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. |
void |
fireContainerEvent(java.lang.String type,
java.lang.Object data)
Notify all container event listeners that a particular event has occurred for this Container. |
AccessLog |
getAccessLog()
Identify the AccessLog to use to log a request/response that was destined for this container but was handled earlier in the processing chain so that the request/response still appears in the correct access logs. |
int |
getBackgroundProcessorDelay()
Get the delay between the invocation of the backgroundProcess method on this container and its children. |
Valve |
getBasic()
Return the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any). |
javax.management.ObjectName[] |
getChildren()
|
Cluster |
getCluster()
Return the Cluster with which this Container is associated. |
java.lang.String |
getContainerSuffix()
|
java.lang.String |
getDomain()
|
Valve |
getFirst()
Return the first valve in the pipeline. |
java.lang.String |
getInfo()
Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>. |
javax.management.ObjectName |
getJmxName()
|
protected java.lang.String |
getJSR77Suffix()
|
Loader |
getLoader()
Return the Loader with which this Container is associated. |
Log |
getLogger()
Return the Logger with which this Container is associated. |
Manager |
getManager()
Return the Manager with which this Container is associated. |
java.lang.Object |
getMappingObject()
Return an object which may be utilized for mapping to this component. |
java.lang.String |
getName()
Return a name string (suitable for use by humans) that describes this Container. |
java.lang.String |
getObjectName()
Return the JMX name associated with this container. |
Container |
getParent()
Return the Container for which this Container is a child, if there is one. |
java.lang.ClassLoader |
getParentClassLoader()
Return the parent class loader (if any) for this web application. |
javax.management.ObjectName |
getParentName()
|
Pipeline |
getPipeline()
Return the Pipeline object that manages the Valves associated with this Container. |
Realm |
getRealm()
Return the Realm with which this Container is associated. |
javax.naming.directory.DirContext |
getResources()
Return the resources DirContext object with which this Container is associated. |
boolean |
getStartChildren()
Return if children of this container will be started automatically when they are added to this container. |
java.lang.String |
getType()
|
javax.management.ObjectName[] |
getValveObjectNames()
|
Valve[] |
getValves()
Return the set of Valves in the pipeline associated with this Container, including the basic Valve (if any). |
void |
init()
Init method, part of the MBean lifecycle. |
void |
invoke(Request request,
Response response)
Process the specified Request, to produce the corresponding Response, by invoking the first Valve in our pipeline (if any), or the basic Valve otherwise. |
void |
logAccess(Request request,
Response response,
long time,
boolean useDefault)
Check this container for an access log and if none is found, look to the parent. |
protected java.lang.String |
logName()
Return the abbreviated name of this container for logging messsages |
void |
postDeregister()
|
void |
postRegister(java.lang.Boolean registrationDone)
|
void |
preDeregister()
|
javax.management.ObjectName |
preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
|
void |
removeChild(Container child)
Remove an existing child Container from association with this parent Container. |
void |
removeContainerListener(ContainerListener listener)
Remove a container event listener from this component. |
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component. |
void |
removeValve(Valve valve)
Remove the specified Valve from the pipeline associated with this Container, if it is found; otherwise, do nothing. |
void |
setBackgroundProcessorDelay(int delay)
Set the delay between the invocation of the execute method on this container and its children. |
void |
setBasic(Valve valve)
Set the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any). |
void |
setCluster(Cluster cluster)
Set the Cluster with which this Container is associated. |
void |
setDomain(java.lang.String domain)
|
void |
setLoader(Loader loader)
Set the Loader with which this Container is associated. |
void |
setManager(Manager manager)
Set the Manager with which this Container is associated. |
void |
setName(java.lang.String name)
Set a name string (suitable for use by humans) that describes this Container. |
void |
setParent(Container container)
Set the parent Container to which this Container is being added as a child. |
void |
setParentClassLoader(java.lang.ClassLoader parent)
Set the parent class loader (if any) for this web application. |
void |
setRealm(Realm realm)
Set the Realm with which this Container is associated. |
void |
setResources(javax.naming.directory.DirContext resources)
Set the resources DirContext object with which this Container is associated. |
void |
setStartChildren(boolean startChildren)
Set if children of this container will be started automatically when they are added to this container. |
void |
start()
Prepare for active use of the public methods of this Component. |
void |
stop()
Gracefully shut down active use of the public methods of this Component. |
protected void |
threadStart()
Start the background thread that will periodically check for session timeouts. |
protected void |
threadStop()
Stop the background thread that is periodically checking for session timeouts. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.HashMap children
protected int backgroundProcessorDelay
protected LifecycleSupport lifecycle
protected java.util.ArrayList listeners
protected Loader loader
protected Log logger
protected java.lang.String logName
protected Manager manager
protected Cluster cluster
protected java.lang.String name
protected Container parent
protected java.lang.ClassLoader parentClassLoader
protected Pipeline pipeline
protected Realm realm
protected javax.naming.directory.DirContext resources
protected static StringManager sm
protected boolean started
protected boolean initialized
protected boolean startChildren
protected java.beans.PropertyChangeSupport support
protected volatile AccessLog accessLog
protected java.lang.String type
protected java.lang.String domain
protected java.lang.String suffix
protected javax.management.ObjectName oname
protected javax.management.ObjectName controller
protected transient javax.management.MBeanServer mserver
| Constructor Detail |
|---|
public ContainerBase()
| Method Detail |
|---|
public int getBackgroundProcessorDelay()
getBackgroundProcessorDelay in interface Containerpublic void setBackgroundProcessorDelay(int delay)
setBackgroundProcessorDelay in interface Containerdelay - The delay in seconds between the invocation of
backgroundProcess methodspublic java.lang.String getInfo()
<description>/<version>.
getInfo in interface Containerpublic Loader getLoader()
null.
getLoader in interface Containerpublic void setLoader(Loader loader)
setLoader in interface Containerloader - The newly associated loaderpublic Log getLogger()
null.
getLogger in interface Containerpublic Manager getManager()
null.
getManager in interface Containerpublic void setManager(Manager manager)
setManager in interface Containermanager - The newly associated Managerpublic java.lang.Object getMappingObject()
getMappingObject in interface Containerpublic Cluster getCluster()
null.
getCluster in interface Containerpublic void setCluster(Cluster cluster)
setCluster in interface Containercluster - The newly associated Clusterpublic java.lang.String getName()
getName in interface Containerpublic void setName(java.lang.String name)
setName in interface Containername - New name of this container
java.lang.IllegalStateException - if this Container has already been
added to the children of a parent Container (after which the name
may not be changed)public boolean getStartChildren()
public void setStartChildren(boolean startChildren)
startChildren - New value of the startChildren flagpublic Container getParent()
null.
getParent in interface Containerpublic void setParent(Container container)
setParent in interface Containercontainer - Container to which this Container is being added
as a child
java.lang.IllegalArgumentException - if this Container refuses to become
attached to the specified Containerpublic java.lang.ClassLoader getParentClassLoader()
getParentClassLoader in interface Containerpublic void setParentClassLoader(java.lang.ClassLoader parent)
setParentClassLoader in interface Containerparent - The new parent class loaderpublic Pipeline getPipeline()
getPipeline in interface Containerpublic Realm getRealm()
null.
getRealm in interface Containerpublic void setRealm(Realm realm)
setRealm in interface Containerrealm - The newly associated Realmpublic javax.naming.directory.DirContext getResources()
null.
getResources in interface Containerpublic void setResources(javax.naming.directory.DirContext resources)
setResources in interface Containerresources - The newly associated DirContextpublic void addChild(Container child)
setParent() method must be called, with this
Container as an argument. This method may thrown an
IllegalArgumentException if this Container chooses not
to be attached to the specified Container, in which case it is not added
addChild in interface Containerchild - New child Container to be added
java.lang.IllegalArgumentException - if this exception is thrown by
the setParent() method of the child Container
java.lang.IllegalArgumentException - if the new child does not have
a name unique from that of existing children of this Container
java.lang.IllegalStateException - if this Container does not support
child Containerspublic void addContainerListener(ContainerListener listener)
addContainerListener in interface Containerlistener - The listener to addpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface Containerlistener - The listener to addpublic Container findChild(java.lang.String name)
null
findChild in interface Containername - Name of the child Container to be retrievedpublic Container[] findChildren()
findChildren in interface Containerpublic ContainerListener[] findContainerListeners()
findContainerListeners in interface Container
public void invoke(Request request,
Response response)
throws java.io.IOException,
javax.servlet.ServletException
invoke in interface Containerrequest - Request to be processedresponse - Response to be produced
java.lang.IllegalStateException - if neither a pipeline or a basic
Valve have been configured for this Container
java.io.IOException - if an input/output error occurred while
processing
javax.servlet.ServletException - if a ServletException was thrown
while processing this requestpublic void removeChild(Container child)
removeChild in interface Containerchild - Existing child Container to be removedpublic void removeContainerListener(ContainerListener listener)
removeContainerListener in interface Containerlistener - The listener to removepublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface Containerlistener - The listener to removepublic void addLifecycleListener(LifecycleListener listener)
addLifecycleListener in interface Lifecyclelistener - The listener to addpublic LifecycleListener[] findLifecycleListeners()
findLifecycleListeners in interface Lifecyclepublic void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener in interface Lifecyclelistener - The listener to remove
public void start()
throws LifecycleException
start in interface LifecycleLifecycleException - if this component detects a fatal error
that prevents it from being started
public void stop()
throws LifecycleException
stop in interface LifecycleLifecycleException - if this component detects a fatal error
that needs to be reported
public void init()
throws java.lang.Exception
java.lang.Exception
public javax.management.ObjectName getParentName()
throws javax.management.MalformedObjectNameException
javax.management.MalformedObjectNameException
public void destroy()
throws java.lang.Exception
java.lang.Exception
public void logAccess(Request request,
Response response,
long time,
boolean useDefault)
logAccess in interface Containerrequest - Request (associated with the response) to logresponse - Response (associated with the request) to logtime - Time taken to process the request/response in
milliseconds (use 0 if not known)useDefault - Flag that indicates that the request/response should
be logged in the engine's default access logpublic AccessLog getAccessLog()
Container
getAccessLog in interface Containerpublic void addValve(Valve valve)
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 Pipelinevalve - Valve to be added
java.lang.IllegalArgumentException - if this Container refused to
accept the specified Valve
java.lang.IllegalArgumentException - if the specifie Valve refuses to be
associated with this Container
java.lang.IllegalStateException - if the specified Valve is already
associated with a different Containerpublic javax.management.ObjectName[] getValveObjectNames()
public Valve getBasic()
Return the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any).
getBasic in interface Pipelinepublic Valve getFirst()
getFirst in interface Pipelinepublic Valve[] getValves()
getValves in interface Pipelinepublic void removeValve(Valve valve)
removeValve in interface Pipelinevalve - Valve to be removedpublic void setBasic(Valve valve)
Set the Valve instance that has been distinguished as the basic
Valve for this Pipeline (if any). Prioer to setting the basic Valve,
the Valve's setContainer() will be called, if it
implements Contained, with the owning 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.
setBasic in interface Pipelinevalve - Valve to be distinguished as the basic Valvepublic void backgroundProcess()
backgroundProcess in interface Container
public void fireContainerEvent(java.lang.String type,
java.lang.Object data)
type - Event typedata - Event dataprotected java.lang.String logName()
public javax.management.ObjectName getJmxName()
public java.lang.String getObjectName()
Container
getObjectName in interface Containerpublic java.lang.String getDomain()
public void setDomain(java.lang.String domain)
public java.lang.String getType()
protected java.lang.String getJSR77Suffix()
public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
throws java.lang.Exception
preRegister in interface javax.management.MBeanRegistrationjava.lang.Exceptionpublic void postRegister(java.lang.Boolean registrationDone)
postRegister in interface javax.management.MBeanRegistration
public void preDeregister()
throws java.lang.Exception
preDeregister in interface javax.management.MBeanRegistrationjava.lang.Exceptionpublic void postDeregister()
postDeregister in interface javax.management.MBeanRegistrationpublic javax.management.ObjectName[] getChildren()
public javax.management.ObjectName createObjectName(java.lang.String domain,
javax.management.ObjectName parent)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getContainerSuffix()
protected void threadStart()
protected void threadStop()
|
Apache Tomcat 6.0.53 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||