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::HANDLER (3)

.ds Aq ’

NAME

POE::Component::Server::HTTPServer::Handler - request handler interface

CONTENTS

SYNOPSIS



    package MyHandler;
    use base POE::Component::Server::HTTPServer::Handler;
    # import H_CONT and H_FINAL:
    use POE::Component::Server::HTTPServer::Handler;
   
    sub _init {
      my $self = shift;
      my @args = @_;
      # ...
    }
   
    sub handle {
      my $self = shift;
      my $context = shift;
   
      if ( $context->{use_myhandler} ) {
        $context->{response}->code(200);
        $context->{response}->content("Boo!");
        return H_FINAL;
      } else {
        return H_CONT;
      }
    }

    1;



DESCRIPTION

This package defines the standard interface for request handlers. You can subclass this package to define custom behavior.

METHODS

<B>B>$self<B>->handle( B>$context<B> )B> HTTPServer invokes this method on the handler when it determines that the handler should process the request. $context is the request context, which is a hash reference containing data set by the server and by previously executed handlers. Of particular note are the attributes $context->{request} and $context->{response}. See POE::Component::Server::HTTPServer for more details).

handle() should return one of two values (defined in this package, and exported by default): H_FINAL indicates that processing of the request should stop, or H_CONT which indicates that the HTTPServer should continue running handlers.

A request handler will typically either set the headers and content of the response object (and return H_FINAL), or set attributes in the context for later handlers to use (and return H_CONT). A handler may also need to tell the HTTPServer to restart the request dispatching process. The idiom for this is:



    return $context->{dispatcher}->dispatch( $context, "/new/path/to/dispatch/to" );



<B>B>$self<B>->_init( B>@args<B> )B> This method is called by the constructor with all the arguments passed to new(). If you need to handle arguments passed to the constructor, prefer overriding this method to overriding new().

SEE ALSO

POE::Component::Server::HTTPServer, POE::Component::Server::HTTPServer::NotFoundHandler, POE::Component::Server::HTTPServer::BasicAuthenHandler, POE::Component::Server::HTTPServer::ParameterParseHandler, POE::Component::Server::HTTPServer::StaticHandler

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::HANDLER (3) 2004-01-13

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