Container

来源:互联网 发布:霍元甲 大力士 知乎 编辑:程序博客网 时间:2024/03/29 09:40
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:

  • Engine - 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.
  • Host - Representation of a virtual host containing a number of Contexts.
  • Context - Representation of a single ServletContext, which will typically contain one or more Wrappers for the supported servlets.
  • Wrapper - Representation of an individual servlet definition (which may support multiple servlet instances if the servlet itself implements SingleThreadModel).
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:

  • Loader - Class loader to use for integrating new Java classes for this Container into the JVM in which Catalina is running.
  • Logger - Implementation of the log() method signatures of the ServletContext interface.
  • Manager - Manager for the pool of Sessions associated with this Container.
  • Realm - Read-only interface to a security domain, for authenticating user identities and their corresponding roles.
  • Resources - JNDI directory context enabling access to static resources, enabling custom linkages to existing server components when Catalina is embedded in a larger server.

原创粉丝点击