T
- The type of the response returned from the server.public abstract static class VolleyUtil.CacheEntryRequest<T> extends com.android.volley.Request<VolleyUtil.CacheEntryResponse<T>>
VolleyUtil.CacheEntryRequest
class is an extension of Volley's
Request
class and is used to return a response that contains both
the information returned from the server and the cache entry associated
with the returned response.parseCacheHeaders(com.android.volley.NetworkResponse)
method and set custom values
for the ttl (time to live) and soft ttl (soft time to live - the point at
which content should be prefetched).VolleyUtil.CacheEntryResponse
is not guaranteed to have a
non-null cache entry. If the request should not explicitly cache the
result, the returned cache entry will be null (indicating the result was
not cached).Constructor and Description |
---|
CacheEntryRequest(VolleyUtil.CacheEntryRequestParams params,
com.android.volley.Response.Listener<VolleyUtil.CacheEntryResponse<T>> listener,
com.android.volley.Response.ErrorListener errorListener) |
Modifier and Type | Method and Description |
---|---|
protected void |
deliverResponse(VolleyUtil.CacheEntryResponse<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() |
java.lang.String |
getCacheKey()
Returns the cache key for this request.
|
java.util.Map<java.lang.String,java.lang.String> |
getHeaders()
Returns a list of extra HTTP headers to go along with this request.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getParams()
Returns a Map of parameters to be used for a POST or PUT request.
|
VolleyUtil.CacheEntryRequestParams |
getRequestParams() |
protected com.android.volley.Cache.Entry |
parseCacheHeaders(com.android.volley.NetworkResponse nr) |
protected com.android.volley.Response<VolleyUtil.CacheEntryResponse<T>> |
parseNetworkResponse(com.android.volley.NetworkResponse nr)
Subclasses must implement this to parse the raw network response
and return an appropriate response type.
|
protected VolleyUtil.CacheEntryResponse<T> |
parseNetworkResponseCacheEntry(com.android.volley.NetworkResponse nr) |
protected abstract T |
parseNetworkResponseObject(com.android.volley.NetworkResponse nr) |
addMarker, cancel, compareTo, deliverError, getCacheEntry, getMethod, getParamsEncoding, getPostBody, getPostBodyContentType, getPostParams, getPostParamsEncoding, getPriority, getRetryPolicy, getSequence, getTag, getTimeoutMs, getTrafficStatsTag, getUrl, hasHadResponseDelivered, isCanceled, markDelivered, parseNetworkError, setCacheEntry, setRequestQueue, setRetryPolicy, setSequence, setShouldCache, setTag, shouldCache, toString
public CacheEntryRequest(VolleyUtil.CacheEntryRequestParams params, com.android.volley.Response.Listener<VolleyUtil.CacheEntryResponse<T>> listener, com.android.volley.Response.ErrorListener errorListener)
public VolleyUtil.CacheEntryRequestParams getRequestParams()
public java.lang.String getCacheKey()
com.android.volley.Request
getCacheKey
in class com.android.volley.Request<VolleyUtil.CacheEntryResponse<T>>
public java.util.Map<java.lang.String,java.lang.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<VolleyUtil.CacheEntryResponse<T>>
com.android.volley.AuthFailureError
- In the event of auth failureprotected java.util.Map<java.lang.String,java.lang.String> getParams() throws com.android.volley.AuthFailureError
com.android.volley.Request
AuthFailureError
as authentication may be required to provide these values.
Note that you can directly override Request.getBody()
for custom data.
getParams
in class com.android.volley.Request<VolleyUtil.CacheEntryResponse<T>>
com.android.volley.AuthFailureError
- in the event of auth failurepublic java.lang.String getBodyContentType()
getBodyContentType
in class com.android.volley.Request<VolleyUtil.CacheEntryResponse<T>>
public byte[] getBody() throws com.android.volley.AuthFailureError
com.android.volley.Request
getBody
in class com.android.volley.Request<VolleyUtil.CacheEntryResponse<T>>
com.android.volley.AuthFailureError
- in the event of auth failureprotected final com.android.volley.Response<VolleyUtil.CacheEntryResponse<T>> parseNetworkResponse(com.android.volley.NetworkResponse nr)
com.android.volley.Request
parseNetworkResponse
in class com.android.volley.Request<VolleyUtil.CacheEntryResponse<T>>
nr
- Response from the networkprotected final VolleyUtil.CacheEntryResponse<T> parseNetworkResponseCacheEntry(com.android.volley.NetworkResponse nr) throws com.android.volley.VolleyError
com.android.volley.VolleyError
protected abstract T parseNetworkResponseObject(com.android.volley.NetworkResponse nr) throws com.android.volley.VolleyError
com.android.volley.VolleyError
protected com.android.volley.Cache.Entry parseCacheHeaders(com.android.volley.NetworkResponse nr)
protected void deliverResponse(VolleyUtil.CacheEntryResponse<T> response)
com.android.volley.Request
deliverResponse
in class com.android.volley.Request<VolleyUtil.CacheEntryResponse<T>>
response
- The parsed response returned by
Request.parseNetworkResponse(NetworkResponse)