|RC_OK||Everything is ok, please continue processing.|
|RC_DENY||If it is a TransHandler, stop translation handling and carry on with a PreHandler, if it is a PostHandler do nothing, else return denied to the client.|
|RC_WAIT||This is a special handler that suspends the execution of the handlers. They will be suspended until $response->continue() is called, this is usefull if you want to do a long request and not blocck.|
TransHandlers are run before the URI has been resolved, giving them a chance
to change the URI. They can therefore not be registred per directory.
A TransHandler can stop the dispatching of TransHandlers and jump to the next handler type by specifing RC_DENY;
PreHandlers are stacked by directory and run after TransHandler but
before the ContentHandler. They can change ContentHandler (but beware,
other PreHandlers might also change it) and push on PostHandlers.
The handler that is supposed to give the content. When this handler
returns it will send the response object to the client. It will
automaticly add Content-Length and Date if these are not set. If the
response is streaming it will make sure the correct headers are
set. It will also expand any cookies which have been pushed onto the
|ErrorHandler||This handler is called when there is a read or write error on the socket. This is most likely caused by the remote side closing the connection. $resquest->is_error and $response->is_error will return true. Note that PostHanlder will still called, but TransHandler and PreHandler wont be. It is a map to coderefs just like ContentHandler is.|
These handlers are run after the socket has been flushed.
If you turn on streaming in any other handler, the request is placed in
streaming mode. This handler is called, with the usual parameters, when
streaming mode is first entered, and subsequently when each block of data is
flushed to the client.
Streaming mode is turned on via the $response object:
You deactivate streaming mode with the same object:
Content is also sent to the client via the $response object:
The output filter is set to POE::Filter::Stream, which passes the data through unchanged. If you are doing a multipart/mixed response, you will have to set up your own headers.
Another example can be found in t/30_stream.t. The parts dealing with multipart/mixed are well documented and at the end of the file.
NOTE: Changes in streaming mode are only verified when StreamHandler exits. So you must either turn streaming off in your StreamHandler, or make sure that the StreamHandler will be called again. This last is done by sending data to the client. If for some reason you have no data to send, you can get the same result with continue. Remember that this will also cause the StreamHandler to be called one more time.
This might be a bug. Are there any cases where wed want to keep the connection open after a stream?
The shutdown event may be sent to the component indicating that it should shut down. The event may be sent using the return value of the new() method (which is a session id) by either post()ing or call()ing.
Ive experienced some problems with the session not receiving the event when it gets post()ed so call() is advised.
Please also take a look at HTTP::Response, HTTP::Request, URI, POE and POE::Filter::HTTPD
Document Connection Response and Request objects. Write more tests Add a PoCo::Server::HTTP::Session that matches a http session against poe session using cookies or other state system Add more options to streaming Figure out why post()ed shutdown events dont get received. Probably lots of other API changes
Arthur Bergman, firstname.lastname@example.org
Additional hacking by Philip Gwyn, poe-at-pied.nu
Released under the same terms as POE.
|perl v5.20.3||POE::COMPONENT::SERVER::HTTP (3)||2006-05-23|