Class JsonObjectRequest

  extended by<T>
      extended by<org.json.JSONObject>
          extended by
All Implemented Interfaces:

public class JsonObjectRequest
extends JsonRequest<org.json.JSONObject>

A request for retrieving a JSONObject response body at a given URL, allowing for an optional JSONObject to be passed in as part of the request body.

Nested Class Summary
Nested classes/interfaces inherited from class
Request.Method, Request.Priority
Constructor Summary
JsonObjectRequest(int method, java.lang.String url, org.json.JSONObject jsonRequest, Listener<org.json.JSONObject> listener)
          Creates a new request.
JsonObjectRequest(java.lang.String url, org.json.JSONObject jsonRequest, Listener<org.json.JSONObject> listener)
          Constructor which defaults to GET if jsonRequest is null, POST otherwise.
Method Summary
protected  Response<org.json.JSONObject> parseNetworkResponse(NetworkResponse response)
          Subclasses must implement this to parse the raw network response and return an appropriate response type.
Methods inherited from class
getBody, getBodyContentType
Methods inherited from class
addHeader, addMarker, cancel, compareTo, deliverCancel, deliverDownloadProgress, deliverError, deliverFinish, deliverNetworking, deliverPreExecute, deliverRetry, deliverSuccess, deliverUsedCache, finish, getCacheExpireTime, getCacheKey, getHeaders, getMethod, getParams, getParamsEncoding, getPriority, getRetryPolicy, getSequence, getTag, getTimeoutMs, getUrl, handleResponse, hasHadResponseDelivered, isCanceled, isForceUpdate, markDelivered, parseNetworkError, perform, prepare, removeHeader, setCacheExpireTime, setForceUpdate, setListener, setRequestQueue, setRetryPolicy, setSequence, setTag, shouldCache, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public JsonObjectRequest(int method,
                         java.lang.String url,
                         org.json.JSONObject jsonRequest,
                         Listener<org.json.JSONObject> listener)
Creates a new request.

method - the HTTP method to use
url - URL to fetch the JSON from
jsonRequest - A JSONObject to post with the request. Null is allowed and indicates no parameters will be posted along with request.
listener - Listener to receive the JSON response or error message


public JsonObjectRequest(java.lang.String url,
                         org.json.JSONObject jsonRequest,
                         Listener<org.json.JSONObject> listener)
Constructor which defaults to GET if jsonRequest is null, POST otherwise.

See Also:
JsonObjectRequest(int, String, JSONObject, Listener)
Method Detail


protected Response<org.json.JSONObject> parseNetworkResponse(NetworkResponse response)
Description copied from class: Request
Subclasses must implement this to parse the raw network response and return an appropriate response type. This method will be called from a worker thread. The response will not be delivered if you return null.

Specified by:
parseNetworkResponse in class JsonRequest<org.json.JSONObject>
response - Response from the network
The parsed response, or null in the case of an error