public static interface Net.HttpResponseListener
Net.HttpResponse is ready to be processed, register it with
Net.sendHttpRequest(HttpRequest, HttpResponseListener).| Modifier and Type | Method and Description |
|---|---|
void |
failed(java.lang.Throwable t)
Called if the
Net.HttpRequest failed because an exception when processing the HTTP request, could be a timeout any
other reason (not an HTTP error). |
void |
handleHttpResponse(Net.HttpResponse httpResponse)
Called when the
Net.HttpRequest has been processed and there is a Net.HttpResponse ready. |
void handleHttpResponse(Net.HttpResponse httpResponse)
Net.HttpRequest has been processed and there is a Net.HttpResponse ready. Net.HttpResponse
contains the HttpStatus and should be used to determine if the request was successful or not (see more info at
HttpStatus.getStatusCode()). For example:
HttpResponseListener listener = new HttpResponseListener() {
public void handleHttpResponse (HttpResponse httpResponse) {
HttpStatus status = httpResponse.getStatus();
if (status.getStatusCode() >= 200 && status.getStatusCode() < 300) {
// it was successful
} else {
// do something else
}
}
}
httpResponse - The Net.HttpResponse with the HTTP response values.void failed(java.lang.Throwable t)
Net.HttpRequest failed because an exception when processing the HTTP request, could be a timeout any
other reason (not an HTTP error).t - If the HTTP request failed because an Exception, t encapsulates it to give more information.