Links Docs Home Config Ref. Home Top Level Elements Server Service Connectors JTC Connectors Coyote HTTP/1.1 Coyote JK 2 HTTP/1.1 JK Webapp Containers Context Engine Host Nested Components Default Context Global Resources Loader Logger Manager Realm Resources Valve |
# Server Configuration Reference ## The Engine Container | print-friendly version
Introduction
The Engine element represents the entire request processing machinery associated with a particular Catalina Service. It receives and processes all requests from one or more Connectors, and returns the completed response to the Connector for ultimate transmission back to the client. Exactly one Engine element MUST be nested inside a Service element, following all of the corresponding Connector elements associated with this Service.
Attributes
> Common Attributes
> > All implementations of Engine support the following attributes:
> > Attribute | Description
> > --- | ---
> > `className` | Java class name of the implementation to use. This class must implement the `org.apache.catalina.Engine` interface. If not specified, the standard value (defined below) will be used.
> > `defaultHost` | The default host name, which identifies the Host that will process requests directed to host names on this server, but which are not configured in this configuration file. This name MUST match the `name` attributes of one of the Host elements nested immediately inside.
> > `jvmRoute` | Identifier which must be used in load balancing scenarios to enable session affinity. The indetifier, which must be unique across all Tomcat 4 servers which participate in the cluster, will be appended to the generated session identifier, therefore allowing the front end proxy to always forward a particular session to the same Tomcat 4 instance.
> > `name` | Logical name of this Engine, used in log and error messages.
> Standard Implementation
> > The standard implementation of Engine is org.apache.catalina.core.StandardEngine. It supports the following additional attributes (in addition to the common attributes listed above):
> > Attribute | Description
> > --- | ---
> > `debug` | The level of debugging detail logged by this Engine to the associated Logger. Higher numbers generate more detailed output. If not specified, the default debugging detail level is zero (0).
Nested Components
You can nest one or more Host elements inside this Engine element, each representing a different virtual host associated with this server. At least one Host is required, and one of the nested Hosts MUST have a name that matches the name specified for the `defaultHost` attribute, listed above. You can optional nest a DefaultContext element inside this Engine element, to define the default characteristics of web applications that are automatically deployed. You can nest at most one instance of the following utility components by nesting a corresponding element inside your Engine element: Logger - Configure a logger that will receive and process all log messages for this Engine, plus messages from Connectors associated with this Engine in the surrounding Service. In addition, this Logger will log messages from subordinate Hosts and Contexts, unless overridden by a Logger configuration at a lower level. Realm - Configure a realm that will allow its database of users, and their associated roles, to be shared across all Hosts and Contexts nested inside this Engine, unless overridden by a Realm configuration at a lower level.
Special Features
> Access Logs
> > When you run a web server, one of the output files normally generated is an access log, which generates one line of information for each request processed by the server, in a standard format. Catalina includes an optional Valve implementation that can create access logs in the same standard format created by web servers, or in any number of custom formats. You can ask Catalina to create an access log for all requests processed by an Engine, Host, or Context by nesting a Valve element like this:
> >     <Engine name="Standalone" ...>
> >       ...
> >       <Valve className="org.apache.catalina.valves.AccessLogValve"
> >              prefix="catalina_access_log." suffix=".txt"
> >              pattern="common"/>
> >       ...
> >     </Engine>
> See Access Log Valve for more information on the configuration attributes that are supported.
> Lifecycle Listeners
> > If you have implemented a Java object that needs to know when this Engine is started or stopped, you can declare it by nesting a Listener element inside this element. The class name you specify must implement the `org.apache.catalina.LifecycleListener` interface, and it will be notified about the occurrence of the coresponding lifecycle events. Configuration of such a listener looks like this:
> >     <Engine name="Standalone" ...>
> >       ...
> >       <Listener className="com.mycompany.mypackage.MyListener" ... >
> >       ...
> >     </Engine>
> Note that a Listener can have any number of additional properties that may be configured from this element. Attribute names are matched to corresponding JavaBean property names using the standard property method naming patterns.
> Request Filters
> > You can ask Catalina to check the IP address, or host name, on every incoming request directed to the surrounding Engine, Host, or Context element. The remote address or name will be checked against a configured list of "accept" and/or "deny" filters, which are defined using the Regular Expression syntax supported by the Jakarta Regexp regular expression library. Requests that come from locations that are not accepted will be rejected with an HTTP "Forbidden" error. Example filter declarations:
> >     <Engine name="Standalone" ...>
> >       ...
> >       <Valve className="org.apache.catalina.valves.RemoteHostValve"
> >              allow="*.mycompany.com,www.yourcompany.com"/>
> >       <Valve className="org.apache.catalina.valves.RemoteAddrValve"
> >              deny="192.168.1.*"/>
> >       ...
> >     </Engine>
> See Remote Address Filter and Remote Host Filter for more information about the configuration options that are supported.
Copyright © 1999-2002, Apache Software Foundation