Package playn.core
Class Net.Response
java.lang.Object
playn.core.Net.Response
- Direct Known Subclasses:
Net.Response.Binary
- Enclosing class:
Net
Communicates an HTTP response to the caller.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Used to deliver binary response data. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of the header with the specified name, or null.Returns the names of all headers returned by the server.Returns the value of all headers with the specified name, or the empty list.byte[]
payload()
Returns the response payload as raw bytes.payloadImage
(Scale scale) Returns the response payload as anImage
.abstract String
Returns the response payload as a string, decoded using the character set specified in the response's content type.int
Returns the HTTP response code provided by the server.
-
Method Details
-
responseCode
public int responseCode()Returns the HTTP response code provided by the server. -
headerNames
Returns the names of all headers returned by the server. -
header
Returns the value of the header with the specified name, or null. If there are multiple response headers with this name, one will be chosen using an undefined algorithm. -
headers
Returns the value of all headers with the specified name, or the empty list.NOTE: on the iOS backend, repeated headers will be coalesced into a single header separated by commas. This sucks but we can't "undo" the coalescing without breaking otherwise normal headers that happent to contain commas. Complain to Apple.
-
payloadString
Returns the response payload as a string, decoded using the character set specified in the response's content type. -
payload
public byte[] payload()Returns the response payload as raw bytes. Note: this is not available on the HTML backend. -
payloadImage
Returns the response payload as anImage
. Note: this is not available on the HTML backend.- Parameters:
scale
- the scale to use for the loaded image. ProbablyScale.ONE
unless you know you're loading a HiDPI image.- Throws:
Exception
- if image decoding fails.
-