类 | |
| interface | Method |
| enum | Priority |
Public 成员函数 | |
| Request (String url, Response.ErrorListener listener) | |
| Request (int method, String url, Response.ErrorListener listener) | |
| int | getMethod () |
| void | setTag (Object tag) |
| Object | getTag () |
| int | getTrafficStatsTag () |
| void | setRetryPolicy (RetryPolicy retryPolicy) |
| void | addMarker (String tag) |
| void | setRequestQueue (RequestQueue requestQueue) |
| final void | setSequence (int sequence) |
| final int | getSequence () |
| String | getUrl () |
| String | getCacheKey () |
| void | setCacheEntry (Cache.Entry entry) |
| Cache.Entry | getCacheEntry () |
| void | cancel () |
| boolean | isCanceled () |
| Map< String, String > | getHeaders () throws AuthFailureError |
| String | getPostBodyContentType () |
| byte[] | getPostBody () throws AuthFailureError |
| String | getBodyContentType () |
| byte[] | getBody () throws AuthFailureError |
| final void | setShouldCache (boolean shouldCache) |
| final boolean | shouldCache () |
| Priority | getPriority () |
| final int | getTimeoutMs () |
| RetryPolicy | getRetryPolicy () |
| void | markDelivered () |
| boolean | hasHadResponseDelivered () |
| void | deliverError (VolleyError error) |
| int | compareTo (Request< T > other) |
| String | toString () |
Protected 成员函数 | |
| Map< String, String > | getPostParams () throws AuthFailureError |
| String | getPostParamsEncoding () |
| Map< String, String > | getParams () throws AuthFailureError |
| String | getParamsEncoding () |
| abstract Response< T > | parseNetworkResponse (NetworkResponse response) |
| VolleyError | parseNetworkError (VolleyError volleyError) |
| abstract void | deliverResponse (T response) |
包函数 | |
| void | finish (final String tag) |
Private 成员函数 | |
| byte[] | encodeParameters (Map< String, String > params, String paramsEncoding) |
Private 属性 | |
| final MarkerLog | mEventLog = MarkerLog.ENABLED ? new MarkerLog() : null |
| final int | mMethod |
| final String | mUrl |
| final int | mDefaultTrafficStatsTag |
| final Response.ErrorListener | mErrorListener |
| Integer | mSequence |
| RequestQueue | mRequestQueue |
| boolean | mShouldCache = true |
| boolean | mCanceled = false |
| boolean | mResponseDelivered = false |
| long | mRequestBirthTime = 0 |
| RetryPolicy | mRetryPolicy |
| Cache.Entry | mCacheEntry = null |
| Object | mTag |
静态 Private 属性 | |
| static final String | DEFAULT_PARAMS_ENCODING = "UTF-8" |
| static final long | SLOW_REQUEST_THRESHOLD_MS = 3000 |
Base class for all network requests.
| <T> | The type of parsed response this request expects. |
|
inline |
Creates a new request with the given URL and error listener. Note that the normal response listener is not provided here as delivery of responses is provided by subclasses, who have a better idea of how to deliver an already-parsed response.
|
inline |
Creates a new request with the given method (one of the values from Method), URL, and error listener. Note that the normal response listener is not provided here as delivery of responses is provided by subclasses, who have a better idea of how to deliver an already-parsed response.
|
inline |
Adds an event to this request's event log; for debugging.
|
inline |
Mark this request as canceled. No callback will be delivered.
|
inline |
Our comparator sorts from high to low priority, and secondarily by sequence number to provide FIFO ordering.
|
inline |
Delivers error message to the ErrorListener that the Request was initialized with.
| error | Error details |
|
abstractprotected |
Subclasses must implement this to perform delivery of the parsed response to their listeners. The given response is guaranteed to be non-null; responses that fail to parse are not delivered.
| response | The parsed response returned by parseNetworkResponse(NetworkResponse) |
|
inlineprivate |
Converts params into an application/x-www-form-urlencoded encoded string.
|
inlinepackage |
Notifies the request queue that this request has finished (successfully or with error).
Also dumps all events from this request's event log; for debugging.
|
inline |
Returns the raw POST or PUT body to be sent.
| AuthFailureError | in the event of auth failure |
|
inline |
|
inline |
Returns the annotated cache entry, or null if there isn't one.
|
inline |
Returns the cache key for this request. By default, this is the URL.
|
inline |
Returns a list of extra HTTP headers to go along with this request. Can throw AuthFailureError as authentication may be required to provide these values.
| AuthFailureError | In the event of auth failure |
|
inline |
Return the method for this request. Can be one of the values in Method.
|
inlineprotected |
Returns a Map of parameters to be used for a POST or PUT request. Can throw AuthFailureError as authentication may be required to provide these values.
Note that you can directly override getBody() for custom data.
| AuthFailureError | in the event of auth failure |
|
inlineprotected |
Returns which encoding should be used when converting POST or PUT parameters returned by getParams() into a raw POST or PUT body.
This controls both encodings:
|
inline |
|
inline |
|
inlineprotected |
Returns a Map of POST parameters to be used for this request, or null if a simple GET should be used. Can throw AuthFailureError as authentication may be required to provide these values.
Note that only one of getPostParams() and getPostBody() can return a non-null value.
| AuthFailureError | In the event of auth failure |
|
inlineprotected |
Returns which encoding should be used when converting POST parameters returned by getPostParams() into a raw POST body.
This controls both encodings:
|
inline |
Returns the Priority of this request; Priority#NORMAL by default.
|
inline |
Returns the retry policy that should be used for this request.
|
inline |
Returns the sequence number of this request.
|
inline |
Returns this request's tag.
|
inline |
Returns the socket timeout in milliseconds per retry attempt. (This value can be changed per retry attempt if a backoff is specified via backoffTimeout()). If there are no retry attempts remaining, this will cause delivery of a TimeoutError error.
|
inline |
|
inline |
Returns the URL of this request.
|
inline |
Returns true if this request has had a response delivered for it.
|
inline |
Returns true if this request has been canceled.
|
inline |
Mark this request as having a response delivered on it. This can be used later in the request's lifetime for suppressing identical responses.
|
inlineprotected |
Subclasses can override this method to parse 'networkError' and return a more specific error.
The default implementation just returns the passed 'networkError'.
| volleyError | the error retrieved from the network |
|
abstractprotected |
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.
| response | Response from the network |
|
inline |
Annotates this request with an entry retrieved for it from cache. Used for cache coherency support.
|
inline |
Associates this request with the given queue. The request queue will be notified when this request has finished.
|
inline |
Sets the retry policy for this request.
|
inline |
Sets the sequence number of this request. Used by RequestQueue.
|
inline |
Set whether or not responses to this request should be cached.
|
inline |
Set a tag on this request. Can be used to cancel all requests with this tag by RequestQueue#cancelAll(Object).
|
inline |
Returns true if responses to this request should be cached.
|
inline |
|
staticprivate |
Default encoding for POST or PUT parameters. See getParamsEncoding().
|
private |
When a request can be retrieved from cache but must be refreshed from the network, the cache entry will be stored here so that in the event of a "Not Modified" response, we can be sure it hasn't been evicted from cache.
|
private |
Whether or not this request has been canceled.
|
private |
Default tag for TrafficStats.
|
private |
Listener interface for errors.
|
private |
An event log tracing the lifetime of this request; for debugging.
|
private |
Request method of this request. Currently supports GET, POST, PUT, and DELETE.
|
private |
|
private |
The request queue this request is associated with.
|
private |
Whether or not a response has been delivered for this request yet.
|
private |
The retry policy for this request.
|
private |
Sequence number of this request, used to enforce FIFO ordering.
|
private |
Whether or not responses to this request should be cached.
|
private |
An opaque token tagging this request; used for bulk cancellation.
|
private |
URL of this request.
|
staticprivate |
Threshold at which we should log the request (even when debug logging is not enabled).
1.8.8