java.lang.Object | |
↳ | com.tencent.smtt.export.external.interfaces.UrlRequest.Callback |
Users of Cronet extend this class to receive callbacks indicating the
progress of a UrlRequest
being processed. An instance of this class
is passed in to UrlRequest.Builder
's constructor when
constructing the UrlRequest
.
Note: All methods will be invoked on the thread of the
java.util.concurrent.Executor used during construction of the
UrlRequest
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Callback() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
onCanceled(UrlRequest request, UrlResponseInfo info)
Invoked if request was canceled via
cancel() . | ||||||||||
abstract void |
onFailed(UrlRequest request, UrlResponseInfo info, X5netException error)
Invoked if request failed for any reason after
start() . | ||||||||||
abstract void |
onReadCompleted(UrlRequest request, UrlResponseInfo info, ByteBuffer byteBuffer)
Invoked whenever part of the response body has been read.
| ||||||||||
abstract void |
onRedirectReceived(UrlRequest request, UrlResponseInfo info, String newLocationUrl)
Invoked whenever a redirect is encountered.
| ||||||||||
abstract void |
onResponseStarted(UrlRequest request, UrlResponseInfo info)
Invoked when the final set of headers, after all redirects, is received.
| ||||||||||
abstract void |
onSucceeded(UrlRequest request, UrlResponseInfo info)
Invoked when request is completed successfully.
| ||||||||||
void |
shouldInterceptResponseHeader(UrlRequest request, HashMap<String, String> responseHeader)
Called when response
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Invoked if request was canceled via cancel()
. Once
invoked, no other UrlRequest.Callback
methods will be invoked.
Default implementation takes no action.
request | Request that was canceled. |
---|---|
info | Response information. May be null if no response was
received.
|
Invoked if request failed for any reason after start()
.
Once invoked, no other UrlRequest.Callback
methods will be invoked.
error
provides information about the failure.
request | Request that failed. |
---|---|
info | Response information. May be null if no response was
received. |
error | information about error. |
Invoked whenever part of the response body has been read. Only part of
the buffer may be populated, even if the entire response body has not yet
been consumed.
With the exception of onCanceled()
,
no other UrlRequest.Callback
method will be invoked for the request,
including onSucceeded()
and onFailed()
, until UrlRequest.read()
is called to attempt to continue
reading the response body.
request | Request that received data. |
---|---|
info | Response information. |
byteBuffer | The buffer that was passed in to
UrlRequest.read() , now containing the
received data. The buffer's position is updated to the end of
the received data. The buffer's limit is not changed. |
Exception | if an error occurs while processing a read completion.
onFailed(UrlRequest, UrlResponseInfo, X5netException) will be called with the thrown exception set as the cause of
the CallbackException .
|
---|
Invoked whenever a redirect is encountered. This will only be invoked
between the call to start()
and
onResponseStarted()
.
The body of the redirect response, if it has one, will be ignored.
The redirect will not be followed until the URLRequest's
followRedirect()
method is called, either
synchronously or asynchronously.
request | Request being redirected. |
---|---|
info | Response information. |
newLocationUrl | Location where request is redirected. |
Exception | if an error occurs while processing a redirect. onFailed(UrlRequest, UrlResponseInfo, X5netException)
will be called with the thrown exception set as the cause of the
CallbackException .
|
---|
Invoked when the final set of headers, after all redirects, is received.
Will only be invoked once for each request.
With the exception of onCanceled()
,
no other UrlRequest.Callback
method will be invoked for the request,
including onSucceeded()
and onFailed()
, until UrlRequest.read()
is called to attempt to start reading the response
body.
request | Request that started to get response. |
---|---|
info | Response information. |
Exception | if an error occurs while processing response start. onFailed(UrlRequest, UrlResponseInfo, X5netException)
will be called with the thrown exception set as the cause of the
CallbackException .
|
---|
Invoked when request is completed successfully. Once invoked, no other
UrlRequest.Callback
methods will be invoked.
request | Request that succeeded. |
---|---|
info | Response information. |
Called when response