-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceCall.Factory
-
Method Summary
Modifier and Type Method Description abstract MobonRequestrequest()Returns the original mobonRequest that initiated this call. abstract MobonResponseexecute()Invokes the mobonRequest immediately, and blocks until the response can be processed or is inerror. abstract voidenqueue(Callback responseCallback)Schedules the mobonRequest to be executed at some point in the future. abstract voidcancel()Cancels the mobonRequest, if possible. abstract booleanisExecuted()Returns true if this call has been either executed or enqueued. abstract booleanisCanceled()abstract Callclone()Create a new, identical call to this one which can be enqueued or executed even if this callhas already been. -
-
Method Detail
-
request
abstract MobonRequest request()
Returns the original mobonRequest that initiated this call.
-
execute
abstract MobonResponse execute()
Invokes the mobonRequest immediately, and blocks until the response can be processed or is inerror.
To avoid leaking resources callers should close the MobonResponse which in turn willclose the underlying ResponseBody.
{@code * * // ensure the response (and underlying response body) is closed * try (MobonResponse response = client.newCall(mobonRequest).execute()) { * ... * } * * }The caller may read the response body with the response's body method. Toavoid leaking resources callers must close the response body or theMobonResponse.
Note that transport-layer success (receiving a HTTP response code, headers and body) doesnot necessarily indicate application-layer success:
{@code response}may still indicate anunhappy HTTP response code like 404 or 500.
-
enqueue
abstract void enqueue(Callback responseCallback)
Schedules the mobonRequest to be executed at some point in the future.
The dispatcher defines when the mobonRequest will run: usuallyimmediately unless there are several other requests currently being executed.
This client will later call back
{@code responseCallback}with either an HTTP response or afailure exception.
-
cancel
abstract void cancel()
Cancels the mobonRequest, if possible. Requests that are already complete cannot be canceled.
-
isExecuted
abstract boolean isExecuted()
-
isCanceled
abstract boolean isCanceled()
-
-
-
-