NAME
MojoX::Dispatcher::Static - Serve Static Files
SYNOPSIS
use MojoX::Dispatcher::Static;
my $dispatcher = MojoX::Dispatcher::Static->new(
prefix => '/images',
root => '/ftp/pub/images'
);
my $success = $dispatcher->dispatch($c);
DESCRIPTION
MojoX::Dispatcher::Static is a dispatcher for static files.
ATTRIBUTES
MojoX::Dispatcher::Static implements the following attributes.
prefix
my $prefix = $dispatcher->prefix;
$dispatcher = $dispatcher->prefix('/static');
types
my $types = $dispatcher->types;
$dispatcher = $dispatcher->types(MojoX::Types->new);
root
my $root = $dispatcher->root;
$dispatcher = $dispatcher->root('/foo/bar/files');
METHODS
MojoX::Dispatcher::Static inherits all methods from Mojo::Base and implements the follwing the ones.
dispatch
my $success = $dispatcher->dispatch($c);
serve
my $success = $dispatcher->serve($c, 'foo/bar.html');
serve_404
my $success = $dispatcher->serve_404($c);
my $success = $dispatcher->serve_404($c, '404.html');
serve_500
my $success = $dispatcher->serve_500($c);
my $success = $dispatcher->serve_500($c, '500.html');
serve_error
my $success = $dispatcher->serve_error($c, 404);
my $success = $dispatcher->serve_error($c, 404, '404.html');