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 <Perl> 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); } </Perl> # 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> <Location /wombat-examples/servlet> SetHandler perl-script PerlHandler $Apache::Wombat->handler <IfDefine SSL> SSLOptions +StdEnvVars </IfDefine> </Location> IndexIgnore WEB-INF META-INF <LocationMatch (WEB|META)-INF> deny from all </LocationMatch>
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.
PERL_METHOD_HANDLERS
Create and return an instance.
A couple of assumptions are made with regard to the Wombat server's configuration:
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.
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.
await()
stop()
Parameters:
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)
server.xml
$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.
$ENV{HTTPS}
Make sure your SSL module sets $ENV{HTTPS}! With mod_ssl, you can do this with SSLOptions +StdEnvVars.
SSLOptions +StdEnvVars
the Apache request object
mod_perl, Apache, Wombat::Server
Brian Moseley, bcm@maz.org
To install Apache::Wombat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Wombat
CPAN shell
perl -MCPAN -e shell install Apache::Wombat
For more information on module installation, please visit the detailed CPAN module installation guide.