Containers will exist at several conceptual levels within Catalina. The following examples represent common cases:
A Container may also be associated with a number of support components that provide functionality which might be shared (by attaching it to a parent Container) or individually customized. The following support components are currently recognized:
log() method
signatures of the ServletContext interface.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | ADD_CHILD_EVENT
The ContainerEvent event type sent when a child container is added
by |
| public static final String | ADD_VALVE_EVENT
The ContainerEvent event type sent when a valve is added
by |
| public static final String | REMOVE_CHILD_EVENT
The ContainerEvent event type sent when a child container is removed
by |
| public static final String | REMOVE_VALVE_EVENT
The ContainerEvent event type sent when a valve is removed
by |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | addContainerListener(ContainerListener
The listener to add listener)Add a container event listener to this component. |
| public void | addPropertyChangeListener(PropertyChangeListener
The listener to add listener)Add a property change listener to this component. |
| public void | backgroundProcess()
Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. |
| public Container | |
| public Container[] | Returns: An array containing all children of this container. If this Container has no children, a zero-length array is returned.Obtain the child Containers associated with this Container. |
| public ContainerListener[] | Returns: An array containing the container listeners associated with this Container. If this Container has no registered container listeners, a zero-length array is returned.Obtain the container listeners associated with this Container. |
| public void | fireContainerEvent(String
Event type type, Object Event data data)Notify all container event listeners that a particular event has occurred for this Container. |
| public AccessLog | Returns: The AccessLog to use for a request/response destined for this containerObtain the AccessLog to use to log a request/response that is destined for this container. |
| public int | Returns: The delay between the invocation of the backgroundProcess method on this container and its children. A non-positive value indicates that background processing will be managed by the parent.Get the delay between the invocation of the backgroundProcess method on this container and its children. |
| public File | |
| public File | |
| public Cluster | Returns: The Cluster with which this Container is associated. If there is no associated Cluster, return the Cluster associated with our parent Container (if any); otherwise returnnull.Get the Cluster for this container. |
| public static String | Returns: the configuration pathThe container container, String The resource file name resourceName)Find the configuration path where a configuration resource is located. |
| public String | Returns: The JMX domain nameObtain the JMX domain under which this container will be / has been registered. |
| public Log | Returns: The Logger with which this Container is associated. If there is no associated Logger, return the Logger associated with the parent Container (if any); otherwise returnnull.Obtain the log to which events for this container should be logged. |
| public String | Returns: the abbreviated name of this container for logging messagesReturn the logger name that the container will use. |
| public String | Returns: A string suitable for appending to the ObjectNameCalculate the key properties string to be added to an object's
|
| public String | Returns: The human readable name of this container.Return a name string (suitable for use by humans) that describes this Container. |
| public ObjectName | Returns: the JMX name associated with this container.Obtain the JMX name for this container. |
| public Container | Returns: Return the Container for which this Container is a child, if there is one. If there is no defined parent, returnnull.Get the parent container. |
| public ClassLoader | Returns: the parent class loader for this component. If not set, returngetParent().getParentClassLoader(). If no
parent has been set, return the system class loader.Get the parent class loader. |
| public Pipeline | Returns: The PipelineReturn the Pipeline object that manages the Valves associated with this Container. |
| public Realm | Returns: The associated Realm; if there is no associated Realm, the Realm associated with the parent Container (if any); otherwise returnnull.Obtain the Realm with which this Container is associated. |
| public static Service | Returns: the Service, or null if not foundThe container to start from container)Return the Service to which this container belongs. |
| public int | Returns: The currently configured number of threads used to start/stop children associated with this containerObtain the number of threads available for starting and stopping any children associated with this container. |
| public void | logAccess(Request
Request (associated with the response) to log request, Response Response (associated with the request) to log response, long Time taken to process the request/response in
milliseconds (use 0 if not known) time, boolean Flag that indicates that the request/response should
be logged in the engine's default access log useDefault)Log a request/response that was destined for this container but has been handled earlier in the processing chain so that the request/response still appears in the correct access logs. |
| public void | removeChild(Container
Existing child Container to be removed child)Remove an existing child Container from association with this parent Container. |
| public void | removeContainerListener(ContainerListener
The listener to remove listener)Remove a container event listener from this component. |
| public void | removePropertyChangeListener(PropertyChangeListener
The listener to remove listener)Remove a property change listener from this component. |
| public void | setBackgroundProcessorDelay(int
The delay in seconds between the invocation of
backgroundProcess methods delay)Set the delay between the invocation of the execute method on this container and its children. |
| public void | setCluster(Cluster
the Cluster with which this Container is associated. cluster)Set the Cluster with which this Container is associated. |
| public void | |
| public void | |
| public void | setParentClassLoader(ClassLoader
The new parent class loader parent)Set the parent class loader for this component. |
| public void | |
| public void | setStartStopThreads(int
The new number of threads to be used startStopThreads)Sets the number of threads available for starting and stopping any children associated with this container. |
| ADD_CHILD_EVENT | back to summary |
|---|---|
| public static final String ADD_CHILD_EVENT The ContainerEvent event type sent when a child container is added
by | |
| ADD_VALVE_EVENT | back to summary |
|---|---|
| public static final String ADD_VALVE_EVENT The ContainerEvent event type sent when a valve is added
by | |
| REMOVE_CHILD_EVENT | back to summary |
|---|---|
| public static final String REMOVE_CHILD_EVENT The ContainerEvent event type sent when a child container is removed
by | |
| REMOVE_VALVE_EVENT | back to summary |
|---|---|
| public static final String REMOVE_VALVE_EVENT The ContainerEvent event type sent when a valve is removed
by | |
| addChild | back to summary |
|---|---|
| public void addChild(Container child) Add a new child Container to those associated with this Container,
if supported. Prior to adding this Container to the set of children,
the child's
| |
| addContainerListener | back to summary |
|---|---|
| public void addContainerListener(ContainerListener listener) Add a container event listener to this component.
| |
| addPropertyChangeListener | back to summary |
|---|---|
| public void addPropertyChangeListener(PropertyChangeListener listener) Add a property change listener to this component.
| |
| backgroundProcess | back to summary |
|---|---|
| public void backgroundProcess() Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged. | |
| findChild | back to summary |
|---|---|
| public Container findChild(String name) Obtain a child Container by name. | |
| findChildren | back to summary |
|---|---|
| public Container[] findChildren() Obtain the child Containers associated with this Container.
| |
| findContainerListeners | back to summary |
|---|---|
| public ContainerListener[] findContainerListeners() Obtain the container listeners associated with this Container.
| |
| fireContainerEvent | back to summary |
|---|---|
| public void fireContainerEvent(String type, Object data) Notify all container event listeners that a particular event has occurred for this Container. The default implementation performs this notification synchronously using the calling thread. | |
| getAccessLog | back to summary |
|---|---|
| public AccessLog getAccessLog() Obtain the AccessLog to use to log a request/response that is destined for this container. This is typically used when the request/response was handled (and rejected) earlier in the processing chain so that the request/response still appears in the correct access logs.
| |
| getBackgroundProcessorDelay | back to summary |
|---|---|
| public int getBackgroundProcessorDelay() Get the delay between the invocation of the backgroundProcess method on
this container and its children. Child containers will not be invoked if
their delay value is positive (which would mean they are using their own
thread). Setting this to a positive value will cause a thread to be
spawned. After waiting the specified amount of time, the thread will
invoke the
| |
| getCatalinaBase | back to summary |
|---|---|
| public File getCatalinaBase() Obtain the location of CATALINA_BASE.
| |
| getCatalinaHome | back to summary |
|---|---|
| public File getCatalinaHome() Obtain the location of CATALINA_HOME.
| |
| getCluster | back to summary |
|---|---|
| public Cluster getCluster() Get the Cluster for this container.
| |
| getConfigPath | back to summary |
|---|---|
| public static String getConfigPath(Container container, String resourceName) Find the configuration path where a configuration resource is located. | |
| getDomain | back to summary |
|---|---|
| public String getDomain() Obtain the JMX domain under which this container will be / has been registered.
| |
| getLogger | back to summary |
|---|---|
| public Log getLogger() Obtain the log to which events for this container should be logged.
| |
| getLogName | back to summary |
|---|---|
| public String getLogName() Return the logger name that the container will use.
| |
| getMBeanKeyProperties | back to summary |
|---|---|
| public String getMBeanKeyProperties() Calculate the key properties string to be added to an object's
| |
| getName | back to summary |
|---|---|
| public String getName() Return a name string (suitable for use by humans) that describes this Container. Within the set of child containers belonging to a particular parent, Container names must be unique.
| |
| getObjectName | back to summary |
|---|---|
| public ObjectName getObjectName() Obtain the JMX name for this container.
| |
| getParent | back to summary |
|---|---|
| public Container getParent() Get the parent container.
| |
| getParentClassLoader | back to summary |
|---|---|
| public ClassLoader getParentClassLoader() Get the parent class loader.
| |
| getPipeline | back to summary |
|---|---|
| public Pipeline getPipeline() Return the Pipeline object that manages the Valves associated with this Container.
| |
| getRealm | back to summary |
|---|---|
| public Realm getRealm() Obtain the Realm with which this Container is associated.
| |
| getService | back to summary |
|---|---|
| public static Service getService(Container container) Return the Service to which this container belongs. | |
| getStartStopThreads | back to summary |
|---|---|
| public int getStartStopThreads() Obtain the number of threads available for starting and stopping any children associated with this container. This allows start/stop calls to children to be processed in parallel.
| |
| logAccess | back to summary |
|---|---|
| public void logAccess(Request request, Response response, long time, boolean useDefault) Log a request/response that was destined for this container but has been handled earlier in the processing chain so that the request/response still appears in the correct access logs.
| |
| removeChild | back to summary |
|---|---|
| public void removeChild(Container child) Remove an existing child Container from association with this parent Container.
| |
| removeContainerListener | back to summary |
|---|---|
| public void removeContainerListener(ContainerListener listener) Remove a container event listener from this component.
| |
| removePropertyChangeListener | back to summary |
|---|---|
| public void removePropertyChangeListener(PropertyChangeListener listener) Remove a property change listener from this component.
| |
| setBackgroundProcessorDelay | back to summary |
|---|---|
| public void setBackgroundProcessorDelay(int delay) Set the delay between the invocation of the execute method on this container and its children.
| |
| setCluster | back to summary |
|---|---|
| public void setCluster(Cluster cluster) Set the Cluster with which this Container is associated.
| |
| setName | back to summary |
|---|---|
| public void setName(String name) Set a name string (suitable for use by humans) that describes this Container. Within the set of child containers belonging to a particular parent, Container names must be unique.
| |
| setParent | back to summary |
|---|---|
| public void setParent(Container container) Set the parent Container to which this Container is being added as a child. This Container may refuse to become attached to the specified Container by throwing an exception.
| |
| setParentClassLoader | back to summary |
|---|---|
| public void setParentClassLoader(ClassLoader parent) Set the parent class loader for this component. For
| |
| setRealm | back to summary |
|---|---|
| public void setRealm(Realm realm) Set the Realm with which this Container is associated.
| |
| setStartStopThreads | back to summary |
|---|---|
| public void setStartStopThreads(int startStopThreads) Sets the number of threads available for starting and stopping any children associated with this container. This allows start/stop calls to children to be processed in parallel.
| |