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 |
cancelled() |
void |
failed(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. Passing data to the
rendering thread should be done using Application.postRunnable(java.lang.Runnable runnable)
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(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.void cancelled()
Copyright © 2016. All rights reserved.