public class Client extends Object
Client client = new Client(new OrkutProvider(),
new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));
Response response = client.send(PeopleService.getViewer());
The send method either returns a single Response or a Map of
Response objects mapped to ID strings. The data returned from the container
can be extracted from these objects.| Constructor and Description |
|---|
Client(Provider provider,
AuthScheme authScheme)
|
Client(Provider provider,
AuthScheme authScheme,
HttpClient httpClient)
|
| Modifier and Type | Method and Description |
|---|---|
AuthScheme |
getAuthScheme()
Returns the associated
AuthScheme. |
Provider |
getProvider()
Returns the associated
Provider. |
Map<String,Response> |
send(Map<String,Request> requests)
|
Response |
send(Request request)
|
public Client(Provider provider, AuthScheme authScheme)
provider - Provider to associate with new ClientauthScheme - AuthScheme to associate with new Clientpublic Client(Provider provider, AuthScheme authScheme, HttpClient httpClient)
provider - Provider to associate with new ClientauthScheme - AuthScheme to associate with new ClienthttpClient - HttpClient to use with new Clientpublic AuthScheme getAuthScheme()
AuthScheme.public Response send(Request request) throws RequestException, IOException
Request to the associated Provider and
returns the container's response data as a Response object.request - Request object (typically returned from static methods in
service classes) encapsulating all request data including
endpoint, HTTP method, and any required parametersRequestException - if the passed request cannot be serialized, the
container returns an error code, or the response
cannot be parsedIOException - if an I/O error prevents a connection from being
opened or otherwise causes request transmission
to failpublic Map<String,Response> send(Map<String,Request> requests) throws RequestException, IOException
Map of Requests to the associated
Provider and returns the container's response data as a Map of
Response objects mapped to the same IDs as the passed requests. If
the associated provider supports the OpenSocial RPC protocol, only one
HTTP request is sent; otherwise, one HTTP request is executed per
container request.requests - Map of Request objects (typically returned from static
methods in service classes) to ID strings; each object
encapsulates the data for a single container request
such as fetching the viewer or creating an activity.RequestException - if the passed request cannot be serialized, the
container returns an error code, or the response
cannot be parsedIOException - if an I/O error prevents a connection from being
opened or otherwise causes request transmission
to failCopyright © 2012. All Rights Reserved.