Apache::Wombat - embed Wombat within an Apache/mod_perl server


  # the following, or something equivalent, goes in httpd.conf or a
  # PerlRequire'd script. any of the standard configuration techniques
  # for mod_perl are acceptable.
  # create an Apache::Wombat instance, telling it where to find its
  # home directory and deployment descriptor
  unless ($Apache::Server::Starting) {
     require Apache::Wombat;
     my $home = '/usr/local/apache';
     my $config = '/usr/local/apache/conf/server.xml';
     $Apache::Wombat = Apache::Wombat->new($home, $config);
  # configure Apache to use Wombat for servlets only, and the default
  # handler for all static content, and to deny access to
  # webapp-private resources.
  Alias /wombat-examples /usr/local/apache/webapps/examples
  <Location /wombat-examples>
    Options Indexes
    AllowOverride None
    Order allow,deny
    Allow from all
  <Location /wombat-examples/servlet>
    SetHandler perl-script
    PerlHandler $Apache::Wombat->handler
    <IfDefine SSL>
      SSLOptions +StdEnvVars
  IndexIgnore WEB-INF META-INF
  <LocationMatch (WEB|META)-INF>
    deny from all


This class embeds a Wombat servlet engine within an Apache/mod_perl server and enables it to act as an Apache request handler during the content handling phase.

Typically an instance of Apache::Wombat is created at server startup time and configured as a method handler for requests that should be served by Wombat.

In order to use this class, mod_perl must be built with PERL_METHOD_HANDLERS enabled.


new($home, $configFile)
Create and return an instance.

A couple of assumptions are made with regard to the Wombat server's configuration:

  1. Exactly one Service is configured, with exactly one Engine and one or more Hosts beneath it. If more than one service is configured, only the first will be used. If the Service or Engine are not configured, the constructor will die.

  2. At most one standard Connector (Apache::Wombat::Connector) and one secure Connector are configured. Any further Connectors will be ignored.

Assuming everything goes OK, for each child process, await() will be called on the child's copy of the server during the child init phase, and stop() will be called on it during the child exit phase. Note that active sessions are not expired when httpd is shutdown (due to some kind of mod_perl bug with registering a server cleanup handler). This is NOT a session persistence mechanism and should not be relied upon as such.


the path to Wombat's home directory, either absolute or relative to the Apache ServerRoot (defaults to the ServerRoot)

the path to Wombat's server deployment descriptor, server.xml, either absolute or relative to the home directory (defaults to $home/conf/server.xml)

Dies if a configuration problem is encountered or if the server cannot be started.


Delegate request processing to the Wombat server. If $ENV{HTTPS} is set, the request is handed to the configured secure Connector; otherwise, the configured standard Connector gets the request.

Make sure your SSL module sets $ENV{HTTPS}! With mod_ssl, you can do this with SSLOptions +StdEnvVars.


the Apache request object


mod_perl, Apache, the Wombat::Server manpage


Brian Moseley,