public class JsonObjectRequest extends JsonRequest<org.json.JSONObject>
JSONObject
response body at a given URL, allowing for an
optional JSONObject
to be passed in as part of the request body.Request.Method, Request.Priority
PROTOCOL_CHARSET
Constructor and Description |
---|
JsonObjectRequest(int method,
java.lang.String url,
org.json.JSONObject jsonRequest,
Response.Listener<org.json.JSONObject> listener,
Response.ErrorListener errorListener)
Creates a new request.
|
JsonObjectRequest(java.lang.String url,
org.json.JSONObject jsonRequest,
Response.Listener<org.json.JSONObject> listener,
Response.ErrorListener errorListener)
Constructor which defaults to
GET if jsonRequest is
null , POST otherwise. |
Modifier and Type | Method and Description |
---|---|
protected Response<org.json.JSONObject> |
parseNetworkResponse(NetworkResponse response)
Subclasses must implement this to parse the raw network response
and return an appropriate response type.
|
deliverResponse, getBody, getBodyContentType, getPostBody, getPostBodyContentType
addMarker, cancel, compareTo, deliverError, getCacheEntry, getCacheKey, getErrorListener, getHeaders, getMethod, getParams, getParamsEncoding, getPostParams, getPostParamsEncoding, getPriority, getRetryPolicy, getSequence, getTag, getTimeoutMs, getTrafficStatsTag, getUrl, hasHadResponseDelivered, isCanceled, markDelivered, parseNetworkError, setCacheEntry, setRequestQueue, setRetryPolicy, setSequence, setShouldCache, setShouldRetryServerErrors, setTag, shouldCache, shouldRetryServerErrors, toString
public JsonObjectRequest(int method, java.lang.String url, org.json.JSONObject jsonRequest, Response.Listener<org.json.JSONObject> listener, Response.ErrorListener errorListener)
method
- the HTTP method to useurl
- URL to fetch the JSON fromjsonRequest
- 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 responseerrorListener
- Error listener, or null to ignore errors.public JsonObjectRequest(java.lang.String url, org.json.JSONObject jsonRequest, Response.Listener<org.json.JSONObject> listener, Response.ErrorListener errorListener)
GET
if jsonRequest
is
null
, POST
otherwise.#JsonObjectRequest(int, String, JSONObject, Listener, ErrorListener)
protected Response<org.json.JSONObject> parseNetworkResponse(NetworkResponse response)
Request
parseNetworkResponse
in class JsonRequest<org.json.JSONObject>
response
- Response from the network