Froody::Server - baseclass for Froody::Server


NAME

Froody::Server - baseclass for Froody::Server


DESCRIPTION

A Froody server. use as:

  #!/usr/bin/perl
  use warnings;
  use strict;
  
  use Froody::Server;
  Froody::Server->dispatch();

..in a CGI script that is a Froody endpoint.

This server accepts a CGI request as the Froody request, and will dispatch the method, and return the XML of the response as the result of the HTTP request. If the dispatcher throws an error, we catch it and wrap it in a the Froody::Response manpage object that represents the error.

You can pass a namespace to dispatch into to the dispatch() call, to override the default the Froody::Dispatch manpage namespace. This is strongly recommended, or your code will be fairly useless.


METHODS

dispatch()

Detects the environment that the Froody server is running under, assembles a request, and dispatches it. Replies to the request with the XML response.

dispatcher()

Returns a dispatcher object set up for this server with the correct request, response and error classes. I find this useful for getting a dispatcher object for testing against when I have a server class with lots of customization in.

send_header($response, $content_type)

Implemented by subclasses. Should send the headers to the client using the content type passed. Should call the $response's cookies method and dtrt with that.

send_body($bytes)

Implmented by subclasses. Sends the body of the connection. $bytes should be a rendered response.

handler

Handler for apache. Passes the request off to dispatch() and returns &Apache::OK if it succeeds.

content_type_for_type($type) / content_type_for_type($type, $header);

Gets and sets the header for a type of server.

Subclassing

There's serveral methods you might want to override in subclasses of these. In particular these methods define what helper classes this uses:

server_class
dispatch_class
request_class
error_class
response_class


BUGS

None known.

Please report any bugs you find via the CPAN RT system. http://rt.cpan.org/NoAuth/ReportBug.html


AUTHOR

Copyright Fotango 2005. All rights reserved.

Please see the main Froody documentation for details of who has worked on this project.

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


SEE ALSO

Froody, the Froody::Dispatch manpage, the Froody::Server::Standalone manpage, the Froody::Server::CGI manpage, the Froody::Server::Apache manpage

 Froody::Server - baseclass for Froody::Server