Wombat - a Perl servlet container
Wombat is a servlet container for Perl. It is not an executable program itself; rather, it is a library that can be used by programs to embed a servlet container. Embedding programs must provide implementations of Connector API classes that adapt Wombat to the surrounding environment. One such connector is Apache::Wombat which embeds a Wombat servlet container within an Apache httpd built with mod_perl.
Currently no developer documentation for Wombat itself is provided beyond the contents of this document and the POD for each Wombat class.
Web application directories are generally located beneath a single application base directory which in turn is usually located beneath the container's home directory.
Each Host configured in the container can use the same application base directory (called
webapps by default) or provide its own,
possibly located outside the container's home directory.
each Application configured in the container has the option of locating its webapp directory outside its Host's application base directory.
A typical directory structure for Wombat embedded within Apache/mod_perl might be:
# container's home dir /usr/local/apache # default hosts's appbase dir /usr/local/apache/webapps # examples app's webapp dir /usr/local/apache/webapps/examples # another host's appbase dir /home/bcm/maz.org/webapps # another app's webapp dir /home/bcm/maz.org/webapps/comics
The behavior and attributes of the Wombat servlet container are controlled by a container deployment descriptor (usually named
server.xml). This file is modeled after the Tomcat 4 equivalent, but it does have slight differences. A full Configuration Guide will be published; until then, the definitions included below are the only documentation:
Elements supported in
server.xml (named with XPath paths, example attribute settings included inline):
Represents the entire perl interpreter, into which one or more Services are deployed. Only one Server may be specified.
Represents a collection of one or more Connectors that share a single Engine (and therefore the web applications visible within that Engine). A display name for the Service (
name="HTTP Service") may be specified. Many Services may be specified for the single Server.
Represents an endpoint by which requests are received and responses are returned. Each Connector passes requests on to its associated Container for processing. The name of a class that implements the Wombat::Connector interface MUST be specified (
className="Apache::Wombat::Connector"), as well as a scheme (
scheme="http" attribute) and any attributes needed by the implementation. A secure flag (
secure="1") may also be set to indicated that the request was transported using SSL. Many Connectors may theoretically be specified for a particular Service, but at this time, the Wombat internals need some refactoring before they can support Connectors for protocols other than HTTP.
Represents the highest level Container associated with a set of Connectors. The Engine discriminates between virtual hosts as necessary and passes the request along to the appropriate Host. A display name for the Engine (
name="Apache-Wombat") may be specified, as well as the name of a default host (
defaultHost="localhost" attribute) to receive requests that are not mapped to other specifically configured Hosts. Only one Engine may be specified for a particular Service.
Unless overridden in a lower level Container, all log messages will be handled by this Logger. The name of a class that implements the Wombat::Logger interface MUST be specified (
className="Apache::Wombat::Logger"), as well as any attributes needed by the implementation. A minimum log level (
level="DEBUG") may also be specified. If no Logger is specified, logging will be disabled for the Container. Only one Logger may be specified for a particular Container.
Unless overridden in a lower level Container, all web applications will be subject to this security Realm. The name of a class that implements the Wombat::Realm interface MUST be specified (
className="Wombat::Realm::DBIRealm"), as well as any attributes needed by the implementation. If no Realm is specified, security will be disabled for the Container. Only one Realm may be specified for a particular Container.
Note that security MUST be also enabled in a particular web application's deployment descriptor in order for the Realm to be relevant to that web application. Therefore a Realm may be configured for an entire Container but only in use for a single Application.
Unless overridden in a lower level Container, all sessions will be managed by this SessionManager. The name of a class that implements the Wombat::SessionManager interface MUST be specified (
className="Wombat::SessionManager::StandardSessionManager"), as well as any attributes needed by the implementation. A maximum inactivity interval/idle out time may also be specified (
maxInactiveInterval="300"). If no SessionManager element is specified, sessions will be disabled for the Container. Only one SessionManager may be specified for a particular Container.
The type of SessionManager used will depend heavily on the environment provided by the embedding program. For instance, a multiprocess Apache/mod_perl server embedding Wombat will require a SessionManager that caches sessions in shared memory, on disk or in some other location that all processes can access, whereas a multithreaded daemon embedding Wombat might use a simple memory-based SessionManager.
Represents a request-processing component that "wraps" around the Servlet that is ultimately responsible for processing the request. The name of a class that implements the Wombat::Valve interface MUST be specified (
className="Wombat::Valve::RequestDumperValve"), as well as any attributes needed by the implementation. Many Valves may be specified for a single Container.
Valves are used to add container functionality for specific Containers, much like Filters are used to add application functionality for specific Servlets. An example of a commonly-used Valve might be a one that logs information about each request (an AccessLogValve perhaps).
Represents a Container associated with a particular virtual host. A Host maps the request URI to a particular web application and passes the request along to the appropriate Application. The name of the host MUST be specified (
name="localhost"), as well as the application base directory (
appBase="webapps") which can be specified absolutely or relative to the container's home directory. Many Hosts (at least one, corresponding to the Engine's default host attribute) may be specified for a single Engine.
Represents an alternate name or names for the virtual host. For a Host named 'maz.org', the Alias '*.maz.org' might be configured to catch requests for specific hosts and subdomains in the domain. The name of the alias MUST be specified (
name="*.maz.org"). Many Aliases may be specified for a particular Host.
A Logger configured for a Host overrides any Logger configured at the Engine level.
A Realm configured for a Host overrides any Realm configured at the Engine level.
A SessionManager configured for a Host overrides any SessionManager configured at the Engine level.
Any Valves configured for a Host add to (and execute after) any Valves configured at the Engine level.
Represents a Container associated with a particular web application. An Application inspects the request URI and passes the request along to the appropriate Servlet (as configured in the web application's deployment descriptor). The display name of the application (
displayName="Examples Application") and the URI path base for the application (
path="/wombat-examples") MUST be specified, as well as the webapp directory (
docBase="examples") which can be specified absolutely or relative to the parent Host's application base directory. Many Applications (at least one, corresponding to the URI path '/') may be specified for a single Host.
A Logger configured for an Application overrides any Logger configured at a higher level.
A Realm configured for an Application overrides any Realm configured at a higher level.
A SessionManager configured for an Application overrides any SessionManager configured at a higher level.
Any Valves configured for an Application add to (and execute after) any Valves configured at a higher level.
Each web application's resources (images, static HTML files, templates and classes) are located in a single webapp directory. This makes it trivially easy to organize and deploy individual web applications.
Each webapp directory MUST contain a directory named
WEB-INF. This directory MUST contain the web application deployment descriptor,
web.xml (see "WEB APPLICATION CONFIGURATION"). Additionally it MAY contain a
lib directory in which application-specific modules are located. If the
lib directory exists, it will be added to
@INC when the application is loaded so that application classes are visible.
All contents of the webapp directory EXCEPT the
WEB-INF directory and everything beneath it will be visible at the path specified for the Application in the container's deployment descriptor (see "CONTAINER CONFIGURATION"). For example, if an application's path is configured as "/wombat-examples", then the file named
index.html located inside the webapp directory would be visible at the URI "/wombat-examples/index.html". The context-relative path of the file would be "/index.html".
The behavior and attributes of a particular web application are controlled by a web application deployment descriptor (
web.xml) as specified in the Java (TM) servlet specification. The elements that may be included in
web.xml are defined in the servlet specification and in the DTD included in the libservlet distribution.
Web application deployment descriptor elements recognized by Wombat:
Elements currently not recognized by Wombat, or for which Wombat does not currently provide feature support:
Wombat will eventually implement the entire Java (TM) servlet specification as adapted to Perl by libservlet. Currently it supports just enough to be classified as a 'proof of concept' servlet container.
Features currently not supported by Wombat but likely to be supported in the near future include:
Features not likely to ever be supported include:
No consideration has been given to threading. When the threading environment in perl has settled down, this may change.
Apache::Wombat, mod_perl, Servlet
Java (TM) Servlet 2.3 Specification: http://www.jcp.org/aboutJava/communityprocess/final/jsr053/
Brian Moseley, email@example.com
Largely inspired by Tomcat, the Apache Java (TM) servlet container at http://jakarta.apache.org/tomcat/. Many thanks!