Package playn.core

Class Net.Response

Direct Known Subclasses:
Enclosing class:

public abstract static class Net.Response extends Object
Communicates an HTTP response to the caller.
  • Method Details

    • responseCode

      public int responseCode()
      Returns the HTTP response code provided by the server.
    • headerNames

      public Iterable<String> headerNames()
      Returns the names of all headers returned by the server.
    • header

      public String header(String name)
      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

      public List<String> headers(String name)
      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

      public abstract String 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

      public Image payloadImage(Scale scale) throws Exception
      Returns the response payload as an Image. Note: this is not available on the HTML backend.
      scale - the scale to use for the loaded image. Probably Scale.ONE unless you know you're loading a HiDPI image.
      Exception - if image decoding fails.