Class Info |
|---|
public abstract class Callback<T> Callback for an asynchronous request. |
Qualifier and Type | Method Name and Description |
|---|---|
public abstract void | onFailure(Submit<T> submit, Throwable t) Called when a request failed to be executed due to an exception. |
public abstract void | onResponse(Submit<T> submit, Response<T> response) Called when the requested remote server successfully responds. |
Method |
|---|
public abstract void onFailure(Submit<T> submit, Throwable t) Called when a request failed to be executed due to an exception, such as request cancellation, connection failure, or timeout during access to the remote server. |
Parameters
Name | Description |
|---|---|
submit | Submit object. |
t | Request exception. |
Method |
|---|
public abstract void onResponse(Submit<T> submit, Response<T> response) throws IOException Called when the requested remote server successfully responds. This method is used to read the input stream of ResponseBody to obtain the response. Before the input stream is closed, this method can obtain the response by reading the input stream. |
Parameters
Name | Description |
|---|---|
submit | Submit object. |
response | Response result. |
Throws
Name | Description |
|---|---|
IOException | If an I/O exception occurs in an asynchronous request. |