public abstract static class HttpClient.ExpectEmptyCallback extends HttpClient.HttpCallback
HttpClient.HttpCallback which expects the HTTP response body to be empty.
Useful as a callback for requests which do not send a body back (such as performing
the PUT requests for subscriptions, etc.).| Constructor and Description |
|---|
HttpClient.ExpectEmptyCallback() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
onBodyNotEmpty(String body)
Called when the HTTP response was considered successful (status code in the 200s),
but the body was not empty.
|
void |
onJsonParseError(JSONException error,
String rawBody)
Invoked when the HTTP request was successful, but the response body could not
be parsed as a JSON object.
|
abstract void |
onSuccess()
Called when the HTTP response was successfully received from the WVA,
and the response body was empty (as expected).
|
void |
onSuccess(JSONObject response)
Calls
onBodyNotEmpty(String), with response.toString(). |
onFailurepublic final void onSuccess(JSONObject response)
onBodyNotEmpty(String), with response.toString().
This method is final so as to minimize user error.
onSuccess in class HttpClient.HttpCallbackresponse - the JSON object from the HTTP responsepublic abstract void onBodyNotEmpty(String body)
body - the HTTP response bodypublic abstract void onSuccess()
public final void onJsonParseError(JSONException error, String rawBody)
This class makes this method final to minimize user error, because this is the point
where empty response bodies are handled (so as to call onSuccess()).
onJsonParseError in class HttpClient.HttpCallbackerror - the JSONException raised while parsing the response bodyrawBody - the body which could not be parsed as JSON