|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public static interface Net.HttpResponseListener
Listener to be able to do custom logic once the Net.HttpResponse
is ready to be processed, register it with
Net.sendHttpRequest(HttpRequest, HttpResponseListener)
.
Method Summary | |
---|---|
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. |
Method Detail |
---|
void handleHttpResponse(Net.HttpResponse httpResponse)
Net.HttpRequest
has been processed and there is a Net.HttpResponse
ready. Net.HttpResponse
contains the Net.HttpStatus
and should be used to determine if the request was successful or not (see more info at
Net.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.
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |