com.google.api.client.googleapis.json
Class GoogleJsonRpcHttpTransport

java.lang.Object
  extended by com.google.api.client.googleapis.json.GoogleJsonRpcHttpTransport

public final class GoogleJsonRpcHttpTransport
extends Object

JSON-RPC 2.0 HTTP transport for RPC requests for Google API's, including both singleton and batched requests.

Warning: this is based on an undocumented experimental Google functionality that may stop working or change in behavior at any time. Beware of this risk if running this in production code.

Since:
1.3
Author:
Yaniv Inbar

Field Summary
 String accept
          Accept header to use for requests.
 String contentType
          Content type header to use for requests.
 JsonFactory jsonFactory
          (REQUIRED) JSON factory to use for building requests.
 GenericUrl rpcServerUrl
          RPC server URL.
 HttpTransport transport
          (REQUIRED) HTTP transport required for building requests.
 
Constructor Summary
GoogleJsonRpcHttpTransport()
           
 
Method Summary
 HttpRequest buildPostRequest(JsonRpcRequest request)
          Builds a POST HTTP request for the JSON-RPC requests objects specified in the given JSON-RPC request object.
 HttpRequest buildPostRequest(List<JsonRpcRequest> requests)
          Builds a POST HTTP request for the JSON-RPC requests objects specified in the given JSON-RPC request objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rpcServerUrl

public GenericUrl rpcServerUrl
RPC server URL.


transport

public HttpTransport transport
(REQUIRED) HTTP transport required for building requests.


jsonFactory

public JsonFactory jsonFactory
(REQUIRED) JSON factory to use for building requests.


contentType

public String contentType
Content type header to use for requests. By default this is "application/json-rpc".


accept

public String accept
Accept header to use for requests. By default this is "application/json-rpc".

Constructor Detail

GoogleJsonRpcHttpTransport

public GoogleJsonRpcHttpTransport()
Method Detail

buildPostRequest

public HttpRequest buildPostRequest(JsonRpcRequest request)
Builds a POST HTTP request for the JSON-RPC requests objects specified in the given JSON-RPC request object.

You may use JsonHttpParser.parserForResponse(execute (request)) to get the JsonParser, and JsonParser.parseAndClose(Class, CustomizeJsonParser) .

Parameters:
request - JSON-RPC request object
Returns:
HTTP request

buildPostRequest

public HttpRequest buildPostRequest(List<JsonRpcRequest> requests)
Builds a POST HTTP request for the JSON-RPC requests objects specified in the given JSON-RPC request objects.

Note that the request will always use batching -- i.e. JSON array of requests -- even if there is only one request. You may use JsonHttpParser.parserForResponse(execute (requests)) to get the JsonParser, and JsonParser.parseArrayAndClose(Collection, Class, CustomizeJsonParser) .

Parameters:
requests - JSON-RPC request objects
Returns:
HTTP request


Copyright © 2010-2012 Google. All Rights Reserved.