NAME
XAS::Service::Server - Perl extension for the XAS environment
SYNOPSIS
use XAS::Service::Server;
my $interface = XAS::Service::Server->new(
-alias => 'server',
-port => 9507,
-address => 'localhost,
-app => $self->build_app($schema),
);
$interface->run();
DESCRIPTION
This module provides a basic web server based on POE. It binds the POE environment to the Plack environment. It's primary mission is to run Web::Machine. This allows for the building of REST based web services quickly and easily. Which also allows the same code base to run as a daemon on UNIX/Linux and a service on Windows.
METHODS
new
This module inherits from XAS::Lib::Net::Server and takes these additional parameters:
process_request($input, $ctx)
This event will process the input from the client. This method will take the HTTP::Request and format it so the Plack application can use the request. The response from the application is then reformated into a HTTP::Response which is sent back to the client. It also sets up a synchronous pipeline to handle this response.
It takes the following parameters:
- $input
-
The input received from the socket.
- $ctx
-
A hash variable to maintain context. This will be initialized with a "wheel" field. Others fields may be added as needed.
process_response($output, $ctx)
This event will process the output for the client. It continues the synchronous pipeline to handle this response.
It takes the following parameters:
- $output
-
The output to be sent to the socket.
- $ctx
-
A hash variable to maintain context. This uses the "wheel" field to direct output to the correct socket. Others fields may have been added as needed.
SEE ALSO
AUTHOR
Kevin L. Esteb, <kevin@kesteb.us>
COPYRIGHT AND LICENSE
Copyright (c) 2012-2016 Kevin L. Esteb
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.