Max Kanat-Alexander

NAME

RPC::Any::Server::JSONRPC::HTTP - A JSON-RPC server that understands HTTP

SYNOPSIS

 use RPC::Any::Server::JSONRPC::HTTP;
 # Create a server where calling Foo.bar will call My::Module->bar.
 my $server = RPC::Any::Server::JSONRPC::HTTP->new(
    dispatch  => { 'Foo' => 'My::Module' },
    allow_get => 0,
 );
 # Read HTTP headers and JSON from STDIN and print result,
 # including HTTP headers, to STDOUT.
 print $server->handle_input();

 # HTTP servers also take HTTP::Request objects, if you want.
 my $request = HTTP::Request->new(POST => '/');
 $request->content('<?xml ... ');
 print $server->handle_input($request);

DESCRIPTION

This is a type of RPC::Any::Server::JSONRPC that understands HTTP. It has all of the features of RPC::Any::Server, RPC::Any::Server::JSONRPC, and RPC::Any::Interface::HTTP. You should see those modules for information on configuring this server and the way it works.

The parser attribute (which you usually don't need to care about) in a JSONRPC::HTTP server is a JSON::RPC::Common::Marshal::HTTP (as opposed to the basic JSONRPC server, where it's a Marshal::Text instead of Marshal::HTTP).

HTTP GET SUPPORT

Since this is based on JSON::RPC::Common, it supports all the various HTTP GET specifications in the various "JSON-RPC over HTTP" specs, if you turn on allow_get.