com.badlogic.gdx
Interface Net.HttpResponse

Enclosing interface:
Net

public static interface Net.HttpResponse

HTTP response interface with methods to get the response data as a byte[], a String or an InputStream.


Method Summary
 String getHeader(String name)
          Returns the value of the header with the given name as a String, or null if the header is not set.
 Map<String,List<String>> getHeaders()
          Returns a Map of the headers.
 byte[] getResult()
          Returns the data of the HTTP response as a byte[].
 InputStream getResultAsStream()
          Returns the data of the HTTP response as an InputStream.
 String getResultAsString()
          Returns the data of the HTTP response as a String.
 HttpStatus getStatus()
          Returns the HttpStatus containing the statusCode of the HTTP response.
 

Method Detail

getResult

byte[] getResult()
Returns the data of the HTTP response as a byte[].

Returns:
the result as a byte[] or null in case of a timeout or if the operation was canceled/terminated abnormally. The timeout is specified when creating the HTTP request, with Net.HttpRequest.setTimeOut(int)

getResultAsString

String getResultAsString()
Returns the data of the HTTP response as a String.

Returns:
the result as a string or null in case of a timeout or if the operation was canceled/terminated abnormally. The timeout is specified when creating the HTTP request, with Net.HttpRequest.setTimeOut(int)

getResultAsStream

InputStream getResultAsStream()
Returns the data of the HTTP response as an InputStream.
Warning:
Do not store a reference to this InputStream outside of HttpResponseListener#handleHttpResponse(HttpResponse). The underlying HTTP connection will be closed after that callback finishes executing. Reading from the InputStream after it's connection has been closed will lead to exception.

Returns:
An InputStream with the Net.HttpResponse data.

getStatus

HttpStatus getStatus()
Returns the HttpStatus containing the statusCode of the HTTP response.


getHeader

String getHeader(String name)
Returns the value of the header with the given name as a String, or null if the header is not set.


getHeaders

Map<String,List<String>> getHeaders()
Returns a Map of the headers. The keys are Strings that represent the header name. Each values is a List of Strings that represent the corresponding header values.



Copyright © 2013. All Rights Reserved.