com.badlogic.gdx
Interface Net.HttpResponseListener

Enclosing interface:
Net

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(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

handleHttpResponse

void handleHttpResponse(Net.HttpResponse httpResponse)
Called when the 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
                }
        }
  }
 

Parameters:
httpResponse - The Net.HttpResponse with the HTTP response values.

failed

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).

Parameters:
t - If the HTTP request failed because an Exception, t encapsulates it to give more information.


Copyright © 2013. All Rights Reserved.