Package com.badlogic.gdx
Interface Net.HttpResponseListener
-
- Enclosing interface:
- Net
public static interface Net.HttpResponseListener
Listener to be able to do custom logic once theNet.HttpResponse
is ready to be processed, register it withNet.sendHttpRequest(HttpRequest, HttpResponseListener)
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cancelled()
void
failed(java.lang.Throwable t)
Called if theNet.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 theNet.HttpRequest
has been processed and there is aNet.HttpResponse
ready.
-
-
-
Method Detail
-
handleHttpResponse
void handleHttpResponse(Net.HttpResponse httpResponse)
Called when theNet.HttpRequest
has been processed and there is aNet.HttpResponse
ready. Passing data to the rendering thread should be done usingApplication.postRunnable(java.lang.Runnable runnable)
Net.HttpResponse
contains theHttpStatus
and should be used to determine if the request was successful or not (see more info atHttpStatus.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 } } }
- Parameters:
httpResponse
- TheNet.HttpResponse
with the HTTP response values.
-
failed
void failed(java.lang.Throwable t)
Called if theNet.HttpRequest
failed because an exception when processing the HTTP request, could be a timeout any other reason (not an HTTP error).- Parameters:
t
- If the HTTP request failed because an Exception, t encapsulates it to give more information.
-
cancelled
void cancelled()
-
-