public class GsonRequest<T>
extends com.android.volley.Request<T>
Modifier and Type | Field and Description |
---|---|
private static String |
ACCEPT
Accept type for request.
|
private static String |
ACCEPT_TYPE |
private Map<String,String> |
headers |
private Gson |
mGson |
private Class<T> |
mJavaClass |
private com.android.volley.Response.Listener<T> |
mListener |
private String |
mRequestBody |
private static String |
PROTOCOL_CHARSET
Charset for request.
|
private static String |
PROTOCOL_CONTENT_TYPE
Content type for request.
|
Constructor and Description |
---|
GsonRequest(int method,
String url,
Class<T> cls,
String requestBody,
com.android.volley.Response.Listener<T> listener,
com.android.volley.Response.ErrorListener 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.
|
String |
getBodyContentType() |
Map<String,String> |
getHeaders()
Returns a list of extra HTTP headers to go along with this request.
|
protected com.android.volley.Response<T> |
parseNetworkResponse(com.android.volley.NetworkResponse response)
Subclasses must implement this to parse the raw network response
and return an appropriate response type.
|
void |
setHeader(String key,
String value) |
addMarker, cancel, compareTo, deliverError, getCacheEntry, getCacheKey, getMethod, getParams, getParamsEncoding, getPostBody, getPostBodyContentType, getPostParams, getPostParamsEncoding, getPriority, getRequestName, getRetryPolicy, getSequence, getTag, getTimeoutMs, getTrafficStatsTag, getUrl, hasHadResponseDelivered, isCanceled, isLoggingEnabled, markDelivered, parseNetworkError, postExecuteImmediatelyAfter, preExecuteJustBefore, setCacheEntry, setRequestName, setRequestQueue, setRetryPolicy, setSequence, setShouldCache, setTag, shouldCache, toString
private static final String PROTOCOL_CHARSET
private static final String PROTOCOL_CONTENT_TYPE
private static final String ACCEPT
private static final String ACCEPT_TYPE
private final com.android.volley.Response.Listener<T> mListener
private final String mRequestBody
private Gson mGson
protected void deliverResponse(T response)
com.android.volley.Request
deliverResponse
in class com.android.volley.Request<T>
response
- The parsed response returned by
Request.parseNetworkResponse(NetworkResponse)
public Map<String,String> getHeaders() throws com.android.volley.AuthFailureError
com.android.volley.Request
AuthFailureError
as authentication may be required to
provide these values.getHeaders
in class com.android.volley.Request<T>
com.android.volley.AuthFailureError
- In the event of auth failureprotected com.android.volley.Response<T> parseNetworkResponse(com.android.volley.NetworkResponse response)
com.android.volley.Request
parseNetworkResponse
in class com.android.volley.Request<T>
response
- Response from the networkpublic String getBodyContentType()
getBodyContentType
in class com.android.volley.Request<T>
public byte[] getBody()
com.android.volley.Request
getBody
in class com.android.volley.Request<T>