Information about a finished request. Passed to RequestFinishedInfo.Listener
.
To associate the data with the original request, use UrlRequest.Builder.addRequestAnnotation(Object)
to add a unique identifier when creating the
request, and call getAnnotations()
when the RequestFinishedInfo
is received to
retrieve the identifier.
Nested Class Summary
class | RequestFinishedInfo.Listener | Listens for finished requests for the purpose of collecting metrics. |
Constant Summary
int | CANCELED | Reason value indicating that the request was canceled. |
int | FAILED | Reason value indicating that the request failed or returned an error. |
int | SUCCEEDED | Reason value indicating that the request succeeded. |
Public Constructor Summary
Public Method Summary
abstract Collection<Object> |
getAnnotations()
Returns the objects that the caller has supplied when initiating the request, using
UrlRequest.Builder.addRequestAnnotation(Object) . |
abstract CronetException |
getException()
If the request failed, returns the same
CronetException provided to UrlRequest.Callback.onFailed(UrlRequest, UrlResponseInfo, CronetException) . |
abstract int |
getFinishedReason()
Returns the reason why the request finished.
|
abstract UrlResponseInfo |
getResponseInfo()
Returns a
UrlResponseInfo for the request, if its response had started. |
abstract String |
getUrl()
Returns the request's original URL.
|
Inherited Method Summary
Constants
public static final int CANCELED
Reason value indicating that the request was canceled. Returned from getFinishedReason()
.
public static final int FAILED
Reason value indicating that the request failed or returned an error. Returned from getFinishedReason()
.
public static final int SUCCEEDED
Reason value indicating that the request succeeded. Returned from getFinishedReason()
.
Public Constructors
public RequestFinishedInfo ()
Public Methods
public abstract Collection<Object> getAnnotations ()
Returns the objects that the caller has supplied when initiating the request, using UrlRequest.Builder.addRequestAnnotation(Object)
. Annotations can be used to associate a
RequestFinishedInfo
with the original request or type of request.
Returns
- annotations supplied when creating the request
public abstract CronetException getException ()
If the request failed, returns the same CronetException
provided to UrlRequest.Callback.onFailed(UrlRequest, UrlResponseInfo, CronetException)
.
Returns
- the request's
CronetException
, if the request failed
public abstract int getFinishedReason ()
public abstract UrlResponseInfo getResponseInfo ()
Returns a UrlResponseInfo
for the request, if its response had started.
Returns
UrlResponseInfo
for the request, if its response had started.
public abstract String getUrl ()
Returns the request's original URL.
Returns
- the request's original URL