T
- Successful response body type.public interface Call<T>
extends java.lang.Cloneable
clone()
to make multiple
calls with the same parameters to the same webserver; this may be used to implement polling or to
retry a failed call.
Calls may be executed synchronously with execute()
, or asynchronously with enqueue(retrofit2.Callback<T>)
. In either case the call can be canceled at any time with cancel()
. A call that
is busy writing its request or reading its response may receive a IOException
; this is
working as designed.
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel this call.
|
Call<T> |
clone()
Create a new, identical call to this one which can be enqueued or executed even if this call
has already been.
|
void |
enqueue(Callback<T> callback)
Asynchronously send the request and notify
callback of its response or if an error
occurred talking to the server, creating the request, or processing the response. |
Response<T> |
execute()
Synchronously send the request and return its response.
|
boolean |
isCanceled()
True if
cancel() was called. |
boolean |
isExecuted()
|
okhttp3.Request |
request()
The original HTTP request.
|
okio.Timeout |
timeout()
Returns a timeout that spans the entire call: resolving DNS, connecting, writing the request
body, server processing, and reading the response body.
|
Response<T> execute() throws java.io.IOException
java.io.IOException
- if a problem occurred talking to the server.java.lang.RuntimeException
- (and subclasses) if an unexpected error occurs creating the request or
decoding the response.void enqueue(Callback<T> callback)
callback
of its response or if an error
occurred talking to the server, creating the request, or processing the response.boolean isExecuted()
void cancel()
boolean isCanceled()
cancel()
was called.Call<T> clone()
okhttp3.Request request()
okio.Timeout timeout()