Package playn.core

Class Net.Builder

java.lang.Object
playn.core.Net.Builder
Enclosing class:
Net

public class Net.Builder extends Object
Builds a request and allows it to be configured and executed.
  • Field Details

    • url

      public final String url
    • headers

      public final List<Net.Header> headers
    • contentType

      public String contentType
    • payloadString

      public String payloadString
    • payloadBytes

      public byte[] payloadBytes
  • Method Details

    • setPayload

      public Net.Builder setPayload(String payload)
      Configures the payload of this request as a UTF-8 string with content type "text/plain". This converts the request to a POST.
    • setPayload

      public Net.Builder setPayload(String payload, String contentType)
      Configures the payload of this request as a UTF-8 string with content type configured as "contentType; charset=UTF-8". The supplied content type should probably be something like text/plain or text/xml or application/json. This converts the request to a POST.
    • setPayload

      public Net.Builder setPayload(byte[] payload)
      Configures the payload of this request as raw bytes with content type "application/octet-stream". This converts the request to a POST.
    • setPayload

      public Net.Builder setPayload(byte[] payload, String contentType)
      Configures the payload of this request as raw bytes with the specified content type. This converts the request to a POST.
    • addHeader

      public Net.Builder addHeader(String name, String value)
      Adds the supplied request header.
      Parameters:
      name - the name of the header (e.g. Authorization).
      value - the value of the header.
    • execute

      public RFuture<Net.Response> execute()
      Executes this request, delivering the response via callback.
    • isPost

      public boolean isPost()
    • method

      public String method()
    • contentType

      public String contentType()