📄 container.java
字号:
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.naming.directory.DirContext;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.juli.logging.Log;
/**
* A <b>Container</b> 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 <b>Pipeline</b> interface
* as well.
* <p>
* Containers will exist at several conceptual levels within Catalina. The
* following examples represent common cases:
* <ul>
* <li><b>Engine</b> - Representation of the entire Catalina servlet engine,
* most likely containing one or more subcontainers that are either Host
* or Context implementations, or other custom groups.
* <li><b>Host</b> - Representation of a virtual host containing a number
* of Contexts.
* <li><b>Context</b> - Representation of a single ServletContext, which will
* typically contain one or more Wrappers for the supported servlets.
* <li><b>Wrapper</b> - Representation of an individual servlet definition
* (which may support multiple servlet instances if the servlet itself
* implements SingleThreadModel).
* </ul>
* 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.
* <p>
* 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:
* <ul>
* <li><b>Loader</b> - Class loader to use for integrating new Java classes
* for this Container into the JVM in which Catalina is running.
* <li><b>Logger</b> - Implementation of the <code>log()</code> method
* signatures of the <code>ServletContext</code> interface.
* <li><b>Manager</b> - Manager for the pool of Sessions associated with
* this Container.
* <li><b>Realm</b> - Read-only interface to a security domain, for
* authenticating user identities and their corresponding roles.
* <li><b>Resources</b> - JNDI directory context enabling access to static
* resources, enabling custom linkages to existing server components when
* Catalina is embedded in a larger server.
* </ul>
*
* @author Craig R. McClanahan
* @author Remy Maucherat
* @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
*/
public interface Container {
// ----------------------------------------------------- Manifest Constants
/**
* The ContainerEvent event type sent when a child container is added
* by <code>addChild()</code>.
*/
public static final String ADD_CHILD_EVENT = "addChild";
/**
* The ContainerEvent event type sent when a Mapper is added
* by <code>addMapper()</code>.
*/
public static final String ADD_MAPPER_EVENT = "addMapper";
/**
* The ContainerEvent event type sent when a valve is added
* by <code>addValve()</code>, if this Container supports pipelines.
*/
public static final String ADD_VALVE_EVENT = "addValve";
/**
* The ContainerEvent event type sent when a child container is removed
* by <code>removeChild()</code>.
*/
public static final String REMOVE_CHILD_EVENT = "removeChild";
/**
* The ContainerEvent event type sent when a Mapper is removed
* by <code>removeMapper()</code>.
*/
public static final String REMOVE_MAPPER_EVENT = "removeMapper";
/**
* The ContainerEvent event type sent when a valve is removed
* by <code>removeValve()</code>, if this Container supports pipelines.
*/
public static final String REMOVE_VALVE_EVENT = "removeValve";
// ------------------------------------------------------------- Properties
/**
* Return descriptive information about this Container implementation and
* the corresponding version number, in the format
* <code><description>/<version></code>.
*/
public String getInfo();
/**
* 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 <code>null</code>.
*/
public Loader getLoader();
/**
* Set the Loader with which this Container is associated.
*
* @param loader The newly associated loader
*/
public void setLoader(Loader loader);
/**
* 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 <code>null</code>.
*/
public Log getLogger();
/**
* 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 <code>null</code>.
*/
public Manager getManager();
/**
* Set the Manager with which this Container is associated.
*
* @param manager The newly associated Manager
*/
public void setManager(Manager manager);
/**
* Return an object which may be utilized for mapping to this component.
*/
public Object getMappingObject();
/**
* Return the JMX name associated with this container.
*/
public String getObjectName();
/**
* Return the Pipeline object that manages the Valves associated with
* this Container.
*/
public Pipeline getPipeline();
/**
* 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 <code>null</code>.
*/
public Cluster getCluster();
/**
* Set the Cluster with which this Container is associated.
*
* @param cluster the Cluster with which this Container is associated.
*/
public void setCluster(Cluster cluster);
/**
* 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 not negative (which would mean they are using
* their own thread). Setting this to a positive value will cause
* a thread to be spawn. After waiting the specified amount of time,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -