URL handlers are now completely replaced by Middleware

This commit is contained in:
Patrick Donelan 2010-04-14 16:25:10 -04:00
parent 9b4e67b828
commit 30a2c09a36
11 changed files with 53 additions and 414 deletions

View file

@ -9,7 +9,16 @@ my $wg = WebGUI->new( root => $root, site => 'dev.localhost.localdomain.conf' );
builder {
enable 'Log4perl', category => 'mysite', conf => "$root/etc/log.conf";
# Reproduce URL handler functionality with middleware
enable '+WebGUI::Middleware::Snoop';
enable 'Static', root => $root, path => sub { s{^/\*give-credit-where-credit-is-due\*$}{docs/credits.txt} };
enable 'Status', path => qr{^/uploads/dictionaries}, status => 401;
# For PassThru, use Plack::Builder::mount
# Extras fallback (you should be using something else to serve static files in production)
my ($extrasURL, $extrasPath) = ( $wg->config->get('extrasURL'), $wg->config->get('extrasPath') );
enable 'Static', root => "$extrasPath/", path => sub { s{^$extrasURL/}{} };
# Open/close the WebGUI::Session at the outer-most onion layer
enable '+WebGUI::Middleware::Session',