GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  POE::COMPONENT::SERVER::HTTPSERVER::STATICHANDLER (3)

.ds Aq ’

NAME

POE::Component::Server::HTTPServer::StaticHandler - serve static files

CONTENTS

SYNOPSIS



  use POE::Component::Server::HTTPServer;
  my $server = POE::Component::Server::HTTPServer->new();
  $server->handlers([ /static => new_handler( StaticHandler,
                                                $static_root ),
                      /static2 => new_handler( StaticHandler,
                                                 $static_root,
                                                 auto_index => 1,
                                                ),
                    ]);



DESCRIPTION

StaticHandler provides a request handler which serves static filesystem resources relative to a given root. It may also be subclassed to handle interpreted requests based on filesystem resources such as parsed or templated pages.

StaticHandler expects to be created with at least one argument. The first argument should be the location of the document root. Requests relative to the prefix associated with this handler will be resolved to file names relative to this directory. If found, the contents of the file will be returned as the response.

StaticHandler may also be given the following arguments when created:
<B>auto_indexB> If set to true, a (crude) directory index response will be generated for requests which map to directories. The default is false.
<B>index_fileB> If defined, requests which map to directories will instead be resolved to this file (in the relevant directory), if such an index file exists. This setting takes precedence over auto_index. The default is index.html.

    Subclassing StaticHandler

When handling requests, StaticHandler invokes two methods which may be overridden to modify the default behavior. One of the following is invoked when StaticHandler resolves a request to a given file or directory:
<B>B>$self<B>->handle_plainfile($filepath, B>$context<B>)B> Called when the request maps to a plain file. $filepath is the full path to the file, and $context is the HTTPServer context.
<B>B>$self<B>->handle_directory($filepath, B>$context<B>)B> Called when the request maps to a directory. $filepath is the full path to the file, and $context is the HTTPServer context.

SEE ALSO

POE::Component::Server::HTTPServer, POE::Component::Server::HTTPServer::TemplateHandler

AUTHOR

Greg Fast <gdf@speakeasy.net>

COPYRIGHT

Copyright 2003 Greg Fast.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 POE::COMPONENT::SERVER::HTTPSERVER::STATICHANDLER (3) 2005-05-20

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.