Static Public Member Functions | Static Private Member Functions | Static Private Attributes
org.xbmc.android.jsonrpc.io.JsonApiRequest Class Reference

List of all members.

Static Public Member Functions

static ObjectNode execute (String url, String user, String pass, ObjectNode entity) throws ApiException

Static Private Member Functions

static String buildUserAgent ()
static ObjectNode parseResponse (String response) throws ApiException
static String postRequest (URL url, String user, String pass, String entity) throws ApiException

Static Private Attributes

static final ObjectMapper OM = new ObjectMapper()
static final int REQUEST_TIMEOUT = 5000
static final String TAG = JsonApiRequest.class.getSimpleName()

Detailed Description

Performs HTTP POST requests on the XBMC JSON API and handles the parsing from and to ObjectNode.

Note: All in here is synchronous.

Author:
Joel Stemmer <stemmertech@gmail.com>
freezy <freezy@xbmc.org>

Definition at line 50 of file JsonApiRequest.java.


Member Function Documentation

static String org.xbmc.android.jsonrpc.io.JsonApiRequest.buildUserAgent ( ) [inline, static, private]

Build user agent used for the HTTP requests

TODO: include version information

Returns:
String containing the user agent

Definition at line 223 of file JsonApiRequest.java.

static ObjectNode org.xbmc.android.jsonrpc.io.JsonApiRequest.execute ( String  url,
String  user,
String  pass,
ObjectNode  entity 
) throws ApiException [inline, static]

Executes a POST request to the URL using the JSON Object as request body and returns a JSON Object if the response was successful.

Parameters:
urlComplete URL with schema, host, port if not default and path.
entityObject being serialized as message body
Returns:
JSON Object of the JSON-RPC response.
Exceptions:
ApiException

Definition at line 66 of file JsonApiRequest.java.

static ObjectNode org.xbmc.android.jsonrpc.io.JsonApiRequest.parseResponse ( String  response) throws ApiException [inline, static, private]

Parses the JSON response string and returns a ObjectNode.

If the response is not valid JSON, contained an error message or did not include a result then a HandlerException is thrown.

Parameters:
response
Returns:
ObjectNode Root node of the server response, unserialized as ObjectNode.
Exceptions:
ApiException

Definition at line 181 of file JsonApiRequest.java.

static String org.xbmc.android.jsonrpc.io.JsonApiRequest.postRequest ( URL  url,
String  user,
String  pass,
String  entity 
) throws ApiException [inline, static, private]

Execute a POST request on URL using entity as request body.

Parameters:
url
entity
Returns:
The response as a string
Exceptions:
ApiException
IOException

Definition at line 84 of file JsonApiRequest.java.


Member Data Documentation

final ObjectMapper org.xbmc.android.jsonrpc.io.JsonApiRequest.OM = new ObjectMapper() [static, private]

Definition at line 55 of file JsonApiRequest.java.

Definition at line 54 of file JsonApiRequest.java.

final String org.xbmc.android.jsonrpc.io.JsonApiRequest.TAG = JsonApiRequest.class.getSimpleName() [static, private]

Definition at line 52 of file JsonApiRequest.java.


The documentation for this class was generated from the following file:


smarthome_media_kodi_driver
Author(s): Mickael Gaillard , Erwan Le Huitouze
autogenerated on Thu Jun 6 2019 21:03:51