| java.lang.Object | ||
| ↳ | org.chromium.net.UrlRequest.Callback | |
| ↳ | org.chromium.net.apihelpers.ImplicitFlowControlCallback | |
|
|
|
|
An implementation of UrlRequest.Callback that takes away the difficulty of managing the
request lifecycle away, and automatically proceeds to read the response entirely.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Invoked if request was canceled via
cancel(). | |||||||||||
Invoked if request failed for any reason after
start(). | |||||||||||
Invoked whenever part of the response body has been read.
| |||||||||||
Invoked whenever a redirect is encountered.
| |||||||||||
Invoked when the final set of headers, after all redirects, is received.
| |||||||||||
Invoked when request is completed successfully.
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Invoked whenever part of the response body has been read.
| |||||||||||
Invoked if request was canceled via
cancel(). | |||||||||||
Invoked if request failed for any reason after
start(). | |||||||||||
Invoked when the final set of headers, after all redirects, is received.
| |||||||||||
Invoked when request is completed successfully.
| |||||||||||
Invoked whenever a redirect is encountered.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||||
|
| |||||||||||
Invoked if request was canceled via cancel(). Once invoked, no other
UrlRequest.Callback methods will be invoked. Default implementation takes no action.
| Parameters | |
|---|---|
request |
UrlRequest: Request that was canceled. |
info |
UrlResponseInfo: 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.
| Parameters | |
|---|---|
request |
UrlRequest: Request that failed. |
info |
UrlResponseInfo: Response information. May be null if no response was received. |
error |
CronetException: 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.
| Parameters | |
|---|---|
request |
UrlRequest: Request that received data. |
info |
UrlResponseInfo: Response information. |
byteBuffer |
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. |
| Throws | |
|---|---|
Exception |
|
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.
| Parameters | |
|---|---|
request |
UrlRequest: Request being redirected. |
info |
UrlResponseInfo: Response information. |
newLocationUrl |
String: Location where request is redirected. |
| Throws | |
|---|---|
Exception |
|
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.
| Parameters | |
|---|---|
request |
UrlRequest: Request that started to get response. |
info |
UrlResponseInfo: Response information. |
| Throws | |
|---|---|
Exception |
|
Invoked when request is completed successfully. Once invoked, no other UrlRequest.Callback
methods will be invoked.
| Parameters | |
|---|---|
request |
UrlRequest: Request that succeeded. |
info |
UrlResponseInfo: Response information.
|
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. The buffer is ready for reading. Buffers are reused internally so the implementing class shouldn't store the buffer or use it anywhere else than in the implementation of this method.
| Parameters | |
|---|---|
info |
UrlResponseInfo: Response information. |
bodyChunk |
ByteBuffer: The buffer that contains the received data, flipped for reading. |
| Throws | |
|---|---|
Exception |
if an error occurs while processing a read completion. onFailed(UrlRequest, UrlResponseInfo, CronetException)
will
be called with the thrown exception set as the cause of the CallbackException.
|
Invoked if request was canceled via cancel(). Once invoked, no other UrlRequest.Callback methods will be invoked.
| Parameters | |
|---|---|
info |
UrlResponseInfo: 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.
| Parameters | |
|---|---|
info |
UrlResponseInfo: Response information. May be null if no response was received. |
exception |
CronetException: information about error.
|
Invoked when the final set of headers, after all redirects, is received. Will only be invoked once for each request. It's guaranteed that Cronet doesn't start reading the body until this method returns.
| Parameters | |
|---|---|
info |
UrlResponseInfo: Response information. |
| Throws | |
|---|---|
Exception |
if an error occurs while processing response start. onFailed(UrlRequest, UrlResponseInfo, CronetException) 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.
| Parameters | |
|---|---|
info |
UrlResponseInfo: Response information.
|
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.
| Parameters | |
|---|---|
info |
UrlResponseInfo: Response information. |
newLocationUrl |
String: Location where request is redirected. |
| Returns | |
|---|---|
boolean |
true if the redirect should be followed, false if the request should be canceled. |
| Throws | |
|---|---|
Exception |
if an error occurs while processing a redirect. onFailed(UrlRequest, UrlResponseInfo, CronetException) will be
called with the thrown exception set as the cause of the CallbackException.
|