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.
A couple of assumptions are made with regard to the Wombat server's configuration:
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.
Parameters:
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.
handler($r)
$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
.
Parameters:
mod_perl, Apache, the Wombat::Server manpage
Brian Moseley, bcm@maz.org