| java.lang.Object | |
| ↳ | org.chromium.net.UrlRequest |
Controls an HTTP request (GET, PUT, POST etc). Created by UrlRequest.Builder, which can
be obtained by calling newUrlRequestBuilder(String, UrlRequest.Callback, Executor). Note: All methods must be
called on the Executor passed to newUrlRequestBuilder(String, UrlRequest.Callback, Executor).
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| UrlRequest.Builder | Builder for UrlRequests. |
||||||||||
| UrlRequest.Callback | Users of Cronet extend this class to receive callbacks indicating the progress of a UrlRequest being processed. |
||||||||||
| UrlRequest.Status | Request status values returned by getStatus(UrlRequest.StatusListener). |
||||||||||
| UrlRequest.StatusListener | Listener class used with getStatus(UrlRequest.StatusListener) to receive the status of a UrlRequest. |
||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Cancels the request.
| |||||||||||
Follows a pending redirect.
| |||||||||||
Queries the status of the request.
| |||||||||||
Returns
true if the request was successfully started and is now finished (completed,
canceled, or failed). | |||||||||||
Attempts to read part of the response body into the provided buffer.
| |||||||||||
Starts the request, all callbacks go to
UrlRequest.Callback. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||||
Cancels the request. Can be called at any time. onCanceled() will
be invoked when cancellation is complete and no further callback methods will be invoked. If
the request has completed or has not started, calling cancel() has no effect and
onCanceled() will not be invoked. If the Executor passed in during UrlRequest construction runs tasks on a single thread, and cancel() is called on
that thread, no callback methods (besides onCanceled()) will be invoked after cancel() is called. Otherwise, at most one callback method may be invoked after cancel() has completed.
Follows a pending redirect. Must only be called at most once for each invocation of onRedirectReceived().
Queries the status of the request.
| Parameters | |
|---|---|
listener |
UrlRequest.StatusListener: a UrlRequest.StatusListener that will be invoked with the request's current
status. listener will be invoked back on the Executor passed in when the
request was created.
|
Returns true if the request was successfully started and is now finished (completed,
canceled, or failed).
| Returns | |
|---|---|
boolean |
true if the request was successfully started and is now finished (completed,
canceled, or failed).
|
Attempts to read part of the response body into the provided buffer. Must only be called at
most once in response to each invocation of the onResponseStarted() and onReadCompleted() methods of the
UrlRequest.Callback. Each call will result in an asynchronous call to either the Callback's onReadCompleted() method if data is read, its
onSucceeded() method if there's no more data to read, or its
onFailed() method if there's an error.
| Parameters | |
|---|---|
buffer |
ByteBuffer: ByteBuffer to write response body to. Must be a direct ByteBuffer. The
embedder must not read or modify buffer's position, limit, or data between its position and
limit until the request calls back into the UrlRequest.Callback.
|
Starts the request, all callbacks go to UrlRequest.Callback. May only be called once. May not be
called if cancel() has been called.