1JSON::RPC::Common::MarsUhsaelr::CHoTnTtPr(i3b)uted PerlJDSoOcNu:m:eRnPtCa:t:iCoonmmon::Marshal::HTTP(3)
2
3
4
6 JSON::RPC::Common::Marshal::HTTP - Convert HTTP::Request and
7 HTTP::Response to/from JSON::RPC::Common calls and returns.
8
10 use JSON::RPC::Common::Marshal::HTTP;
11
12 my $m = JSON::RPC::Common::Marshal::HTTP->new;
13
14 my $call = $m->request_to_call($http_request);
15
16 my $res = $call->call($object);
17
18 my $http_response = $m->result_to_response($res);
19
21 This object provides marshalling routines to convert calls and returns
22 to and from HTTP::Request and HTTP::Response objects.
23
25 prefer_get
26 When encoding a call into a request, prefer GET.
27
28 Not reccomended.
29
30 rest_style_methods
31 When encoding a GET request, use REST style URI formatting (the
32 method is part of the path, not a parameter).
33
34 prefer_encoded_get
35 When set and a "params" param exists, decode it as Base 64 encoded
36 JSON and use that as the parameters instead of the query
37 parameters.
38
39 See http://json-rpc.googlegroups.com/web/json-rpc-over-http.html
40 <http://json-rpc.googlegroups.com/web/json-rpc-over-http.html>.
41
42 user_agent
43 Defaults to the marshal object's class name and the
44 JSON::RPC::Common version number.
45
46 content_type
47 accept_content_type
48 content_types
49 accept_content_types
50 When explicitly set these are the values of the "Content-Type" and
51 "Accept" headers to set.
52
53 Otherwise they will default to "application/json" with
54 calls/returns version 1.0 and 1.1, and "application/json-rpc" with
55 2.0 objects.
56
57 expand
58 Whether or not to use an expander on "GET" style calls.
59
60 expander
61 An instance of CGI::Expand or a look alike to use for "GET"
62 parameter expansion.
63
65 request_to_call $http_request
66 post_request_to_call $http_request
67 get_request_to_call $http_request
68 Convert an HTTP::Request to a JSON::RPC::Common::Procedure::Call.
69 Depending on what style of request it is, "request_to_call" will
70 delegate to a variant method.
71
72 Get requests call "uri_to_call"
73
74 uri_to_call $uri
75 encoded_uri_to_call $uri
76 query_uri_to_call $uri
77 Parse a call from a GET request's URI.
78
79 result_to_response $return
80 Convert a JSON::RPC::Common::Procedure::Return to an
81 HTTP::Response.
82
83 write_result_to_response $result, $response
84 Write the result into an object like Catalyst::Response.
85
86 response_to_result $http_response
87 response_to_result_success $http_response
88 response_to_result_error $http_response
89 Convert an HTTP::Response to a
90 JSON::RPC::Common::Procedure::Return.
91
92 A variant is chosen based on "HTTP::Response/is_success".
93
94 The error handler will ensure that "error" in
95 JSON::RPC::Common::Procedure::Return is set.
96
97 call_to_request $call, %args
98 call_to_get_request $call, %args
99 call_to_post_request $call, %args
100 call_to_uri $call, %args
101 call_to_encoded_uri $call, %args
102 call_to_query_uri $call, %args
103 Convert a call to a request (or just a URI for GET requests).
104
105 The arguments can contain a "uri" parameter, which is the base of
106 the request.
107
108 With GET requests, under "rest_style_methods" that URI's path will
109 be appended, and otherwise parameters will just be added.
110
111 POST requests do not cloen and alter the URI.
112
113 If no URI is provided as an argument, "/" will be used.
114
115 The flags "prefer_get" and "encoded" can also be passed to
116 "call_to_request" to alter the type of request to be generated.
117
118 collapse_query_params
119 expand_query_params
120 Only used for query encoded GET requests. If "expand" is set will
121 cause expansion of the params. Otherwise it's a noop.
122
123 Subclass and override to process query params into RPC params as
124 necessary.
125
126 Note that this is NOT in any of the JSON-RPC specs.
127
128
129
130perl v5.12.0 2009-08-06JSON::RPC::Common::Marshal::HTTP(3)