Package com.badlogic.gdx
Interface Net.HttpResponse
-
- Enclosing interface:
- Net
public static interface Net.HttpResponseHTTP response interface with methods to get the response data as a byte[], aStringor anInputStream.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetHeader(java.lang.String name)Returns the value of the header with the given name as aString, or null if the header is not set.java.util.Map<java.lang.String,java.util.List<java.lang.String>>getHeaders()Returns a Map of the headers.byte[]getResult()Returns the data of the HTTP response as a byte[].java.io.InputStreamgetResultAsStream()Returns the data of the HTTP response as anInputStream.java.lang.StringgetResultAsString()Returns the data of the HTTP response as aString.HttpStatusgetStatus()Returns theHttpStatuscontaining the statusCode of the HTTP response.
-
-
-
Method Detail
-
getResult
byte[] getResult()
Returns the data of the HTTP response as a byte[].Note: This method may only be called once per response.
- 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
java.lang.String getResultAsString()
Returns the data of the HTTP response as aString.Note: This method may only be called once per response.
- 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
java.io.InputStream getResultAsStream()
Returns the data of the HTTP response as anInputStream.
Warning: Do not store a reference to this InputStream outside ofNet.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
InputStreamwith theNet.HttpResponsedata.
-
getStatus
HttpStatus getStatus()
Returns theHttpStatuscontaining the statusCode of the HTTP response.
-
getHeader
java.lang.String getHeader(java.lang.String name)
Returns the value of the header with the given name as aString, or null if the header is not set. SeeHttpResponseHeader.
-
getHeaders
java.util.Map<java.lang.String,java.util.List<java.lang.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. SeeHttpResponseHeader.
-
-