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() |
Performs HTTP POST requests on the XBMC JSON API and handles the parsing from and to ObjectNode.
Note: All in here is synchronous.
Definition at line 50 of file JsonApiRequest.java.
static String org.xbmc.android.jsonrpc.io.JsonApiRequest.buildUserAgent | ( | ) | [inline, static, private] |
Build user agent used for the HTTP requests
TODO: include version information
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.
url | Complete URL with schema, host, port if not default and path. |
entity | Object being serialized as message body |
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.
response |
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.
url | |
entity |
ApiException | |
IOException |
Definition at line 84 of file JsonApiRequest.java.
final ObjectMapper org.xbmc.android.jsonrpc.io.JsonApiRequest.OM = new ObjectMapper() [static, private] |
Definition at line 55 of file JsonApiRequest.java.
final int org.xbmc.android.jsonrpc.io.JsonApiRequest.REQUEST_TIMEOUT = 5000 [static, private] |
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.