Package com.badlogic.gdx
Interface Net.HttpResponseListener
-
- Enclosing interface:
- Net
public static interface Net.HttpResponseListenerListener to be able to do custom logic once theNet.HttpResponseis ready to be processed, register it withNet.sendHttpRequest(HttpRequest, HttpResponseListener).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancelled()voidfailed(java.lang.Throwable t)Called if theNet.HttpRequestfailed because an exception when processing the HTTP request, could be a timeout any other reason (not an HTTP error).voidhandleHttpResponse(Net.HttpResponse httpResponse)Called when theNet.HttpRequesthas been processed and there is aNet.HttpResponseready.
-
-
-
Method Detail
-
handleHttpResponse
void handleHttpResponse(Net.HttpResponse httpResponse)
Called when theNet.HttpRequesthas been processed and there is aNet.HttpResponseready. Passing data to the rendering thread should be done usingApplication.postRunnable(java.lang.Runnable runnable)Net.HttpResponsecontains theHttpStatusand 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.HttpResponsewith the HTTP response values.
-
failed
void failed(java.lang.Throwable t)
Called if theNet.HttpRequestfailed 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()
-
-