Container (Catalina Internal API Documentation)

org.apache.catalina
Interface Container

All Known Subinterfaces:
Context, Deployer, Engine, Host, Wrapper
All Known Implementing Classes:
ContainerBase, StandardContext, StandardEngine, StandardHost, StandardWrapper

public interface Container

A Container is an object that can execute requests received from a client, and return responses based on those requests. A Container may optionally support a pipeline of Valves that process the request in an order configured at runtime, by implementing the Pipeline interface as well.

Containers will exist at several conceptual levels within Catalina. The following examples represent common cases:

A given deployment of Catalina need not include Containers at all of the levels described above. For example, an administration application embedded within a network device (such as a router) might only contain a single Context and a few Wrappers, or even a single Wrapper if the application is relatively small. Therefore, Container implementations need to be designed so that they will operate correctly in the absence of parent Containers in a given deployment.

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:

Version:
$Revision: 1.6 $ $Date: 2001/07/22 20:13:30 $
Author:
Craig R. McClanahan, Remy Maucherat

Field Summary
static java.lang.String ADD_CHILD_EVENT
          The ContainerEvent event type sent when a child container is added by addChild().
static java.lang.String ADD_MAPPER_EVENT
          The ContainerEvent event type sent when a Mapper is added by addMapper().
static java.lang.String ADD_VALVE_EVENT
          The ContainerEvent event type sent when a valve is added by addValve(), if this Container supports pipelines.
static java.lang.String REMOVE_CHILD_EVENT
          The ContainerEvent event type sent when a child container is removed by removeChild().
static java.lang.String REMOVE_MAPPER_EVENT
          The ContainerEvent event type sent when a Mapper is removed by removeMapper().
static java.lang.String REMOVE_VALVE_EVENT
          The ContainerEvent event type sent when a valve is removed by removeValve(), if this Container supports pipelines.
 
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 addMapper(Mapper mapper)
          Add the specified Mapper associated with this Container.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a property change listener to this component.
 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.
 Mapper findMapper(java.lang.String protocol)
          Return the Mapper associated with the specified protocol, if there is one.
 Mapper[] findMappers()
          Return the set of Mappers associated with this Container.
 Cluster getCluster()
          Return the Cluster with which this Container is associated.
 java.lang.String getInfo()
          Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.
 Loader getLoader()
          Return the Loader with which this Container is associated.
 Logger getLogger()
          Return the Logger with which this Container is associated.
 Manager getManager()
          Return the Manager with which this Container is associated.
 java.lang.String getName()
          Return a name string (suitable for use by humans) that describes 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 web applications.
 Realm getRealm()
          Return the Realm with which this Container is associated.
 javax.naming.directory.DirContext getResources()
          Return the Resources with which this Container is associated.
 void invoke(Request request, Response response)
          Process the specified Request, and generate the corresponding Response, according to the design of this particular Container.
 Container map(Request request, boolean update)
          Return the child Container that should be used to process this Request, based upon its characteristics.
 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 removeMapper(Mapper mapper)
          Remove a Mapper associated with this Container, if any.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a property change listener from this component.
 void setCluster(Cluster cluster)
          Set the Cluster with which this Container is associated.
 void setLoader(Loader loader)
          Set the Loader with which this Container is associated.
 void setLogger(Logger logger)
          Set the Logger 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 web applications.
 void setRealm(Realm realm)
          Set the Realm with which this Container is associated.
 void setResources(javax.naming.directory.DirContext resources)
          Set the Resources object with which this Container is associated.
 

Field Detail

ADD_CHILD_EVENT


public static final java.lang.String ADD_CHILD_EVENT
The ContainerEvent event type sent when a child container is added by addChild().

See Also:
Constant Field Values

ADD_MAPPER_EVENT


public static final java.lang.String ADD_MAPPER_EVENT
The ContainerEvent event type sent when a Mapper is added by addMapper().

See Also:
Constant Field Values

ADD_VALVE_EVENT


public static final java.lang.String ADD_VALVE_EVENT
The ContainerEvent event type sent when a valve is added by addValve(), if this Container supports pipelines.

See Also:
Constant Field Values

REMOVE_CHILD_EVENT


public static final java.lang.String REMOVE_CHILD_EVENT
The ContainerEvent event type sent when a child container is removed by removeChild().

See Also:
Constant Field Values

REMOVE_MAPPER_EVENT


public static final java.lang.String REMOVE_MAPPER_EVENT
The ContainerEvent event type sent when a Mapper is removed by removeMapper().

See Also:
Constant Field Values

REMOVE_VALVE_EVENT


public static final java.lang.String REMOVE_VALVE_EVENT
The ContainerEvent event type sent when a valve is removed by removeValve(), if this Container supports pipelines.

See Also:
Constant Field Values
Method Detail

getInfo


public java.lang.String getInfo()
Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.


getLoader


public Loader getLoader()
Return the Loader with which this Container is associated. If there is no associated Loader, return the Loader associated with our parent Container (if any); otherwise, return null.


setLoader


public void setLoader(Loader loader)
Set the Loader with which this Container is associated.

Parameters:
loader - The newly associated loader

getLogger


public Logger getLogger()
Return the Logger with which this Container is associated. If there is no associated Logger, return the Logger associated with our parent Container (if any); otherwise return null.


setLogger


public void setLogger(Logger logger)
Set the Logger with which this Container is associated.

Parameters:
logger - The newly associated Logger

getManager


public Manager getManager()
Return the Manager with which this Container is associated. If there is no associated Manager, return the Manager associated with our parent Container (if any); otherwise return null.


setManager


public void setManager(Manager manager)
Set the Manager with which this Container is associated.

Parameters:
manager - The newly associated Manager

getCluster


public Cluster getCluster()
Return 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 return null.


setCluster


public void setCluster(Cluster cluster)
Set the Cluster with which this Container is associated.


getName


public java.lang.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.


setName


public void setName(java.lang.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.

Parameters:
name - New name of this container
Throws:
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)

getParent


public Container getParent()
Return the Container for which this Container is a child, if there is one. If there is no defined parent, return null.


setParent


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.

Parameters:
container - Container to which this Container is being added as a child
Throws:
java.lang.IllegalArgumentException - if this Container refuses to become attached to the specified Container

getParentClassLoader


public java.lang.ClassLoader getParentClassLoader()
Return the parent class loader (if any) for web applications.


setParentClassLoader


public void setParentClassLoader(java.lang.ClassLoader parent)
Set the parent class loader (if any) for web applications. This call is meaningful only before a Loader has been configured, and the specified value (if non-null) should be passed as an argument to the class loader constructor.

Parameters:
parent - The new parent class loader

getRealm


public Realm getRealm()
Return the Realm with which this Container is associated. If there is no associated Realm, return the Realm associated with our parent Container (if any); otherwise return null.


setRealm


public void setRealm(Realm realm)
Set the Realm with which this Container is associated.

Parameters:
realm - The newly associated Realm

getResources


public javax.naming.directory.DirContext getResources()
Return the Resources with which this Container is associated. If there is no associated Resources object, return the Resources associated with our parent Container (if any); otherwise return null.


setResources


public void setResources(javax.naming.directory.DirContext resources)
Set the Resources object with which this Container is associated.

Parameters:
resources - The newly associated Resources

addChild


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 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

Parameters:
child - New child Container to be added
Throws:
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 Containers

addContainerListener


public void addContainerListener(ContainerListener listener)
Add a container event listener to this component.

Parameters:
listener - The listener to add

addMapper


public void addMapper(Mapper mapper)
Add the specified Mapper associated with this Container.

Parameters:
mapper - The corresponding Mapper implementation
Throws:
java.lang.IllegalArgumentException - if this exception is thrown by the setContainer() method of the Mapper

addPropertyChangeListener


public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component.

Parameters:
listener - The listener to add

findChild


public Container findChild(java.lang.String name)
Return the child Container, associated with this Container, with the specified name (if any); otherwise, return null

Parameters:
name - Name of the child Container to be retrieved

findChildren


public Container[] findChildren()
Return the set of children Containers associated with this Container. If this Container has no children, a zero-length array is returned.


findMapper


public Mapper findMapper(java.lang.String protocol)
Return the Mapper associated with the specified protocol, if there is one. If there is only one defined Mapper, use it for all protocols. If there is no matching Mapper, return null.

Parameters:
protocol - Protocol for which to find a Mapper

findMappers


public Mapper[] findMappers()
Return the set of Mappers associated with this Container. If this Container has no Mappers, a zero-length array is returned.


invoke


public void invoke(Request request,
                   Response response)
            throws java.io.IOException,
                   javax.servlet.ServletException
Process the specified Request, and generate the corresponding Response, according to the design of this particular Container.

Parameters:
request - Request to be processed
response - Response to be produced
Throws:
java.io.IOException - if an input/output error occurred while processing
javax.servlet.ServletException - if a ServletException was thrown while processing this request

map


public Container map(Request request,
                     boolean update)
Return the child Container that should be used to process this Request, based upon its characteristics. If no such child Container can be identified, return null instead.

Parameters:
request - Request being processed
update - Update the Request to reflect the mapping selection?

removeChild


public void removeChild(Container child)
Remove an existing child Container from association with this parent Container.

Parameters:
child - Existing child Container to be removed

removeContainerListener


public void removeContainerListener(ContainerListener listener)
Remove a container event listener from this component.

Parameters:
listener - The listener to remove

removeMapper


public void removeMapper(Mapper mapper)
Remove a Mapper associated with this Container, if any.

Parameters:
mapper - The Mapper to be removed

removePropertyChangeListener


public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component.

Parameters:
listener - The listener to remove


Copyright © 2000-2001 Apache Software Foundation. All Rights Reserved.