T - JSON type of response expectedpublic abstract class JsonRequest<T> extends Request<T>
Request.Method, Request.Priority| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
PROTOCOL_CHARSET
Default charset for JSON request.
|
| Constructor and Description |
|---|
JsonRequest(int method,
java.lang.String url,
java.lang.String requestBody,
Response.Listener<T> listener,
Response.ErrorListener errorListener) |
JsonRequest(java.lang.String url,
java.lang.String requestBody,
Response.Listener<T> listener,
Response.ErrorListener errorListener)
Deprecated.
Use
#JsonRequest(int, String, String, Listener, ErrorListener). |
| Modifier and Type | Method and Description |
|---|---|
protected void |
deliverResponse(T response)
Subclasses must implement this to perform delivery of the parsed
response to their listeners.
|
byte[] |
getBody()
Returns the raw POST or PUT body to be sent.
|
java.lang.String |
getBodyContentType()
Returns the content type of the POST or PUT body.
|
byte[] |
getPostBody()
Deprecated.
Use
getBody(). |
java.lang.String |
getPostBodyContentType()
Deprecated.
Use
getBodyContentType(). |
protected abstract Response<T> |
parseNetworkResponse(NetworkResponse response)
Subclasses must implement this to parse the raw network response
and return an appropriate response type.
|
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, toStringprotected static final java.lang.String PROTOCOL_CHARSET
@Deprecated
public JsonRequest(java.lang.String url,
java.lang.String requestBody,
Response.Listener<T> listener,
Response.ErrorListener errorListener)
#JsonRequest(int, String, String, Listener, ErrorListener).getPostBody()
or Request.getPostParams() is overridden (which defaults to POST).public JsonRequest(int method,
java.lang.String url,
java.lang.String requestBody,
Response.Listener<T> listener,
Response.ErrorListener errorListener)
protected void deliverResponse(T response)
RequestdeliverResponse in class Request<T>response - The parsed response returned by
Request.parseNetworkResponse(NetworkResponse)protected abstract Response<T> parseNetworkResponse(NetworkResponse response)
RequestparseNetworkResponse in class Request<T>response - Response from the network@Deprecated public java.lang.String getPostBodyContentType()
getBodyContentType().getPostBodyContentType in class Request<T>@Deprecated public byte[] getPostBody()
getBody().RequestgetPostBody in class Request<T>public java.lang.String getBodyContentType()
RequestgetBodyContentType in class Request<T>public byte[] getBody()
RequestBy default, the body consists of the request parameters in
application/x-www-form-urlencoded format. When overriding this method, consider overriding
Request.getBodyContentType() as well to match the new body format.