t

play.api.libs.ws

StandaloneWSResponse

trait StandaloneWSResponse extends AnyRef

A WS HTTP response.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StandaloneWSResponse
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def body: String

    The response body decoded as String, using a simple algorithm to guess the encoding.

    The response body decoded as String, using a simple algorithm to guess the encoding.

    This decodes the body to a string representation based on the following algorithm:

    1. Look for a "charset" parameter on the Content-Type. If it exists, set charset to its value and go to step 3. 2. If the Content-Type is of type "text", set charset to "ISO-8859-1"; else set charset to "UTF-8". 3. Decode the raw bytes of the body using charset.

    Note that this does not take into account any special cases for specific content types. For example, for application/json, we do not support encoding autodetection and will trust the charset parameter if provided..

    returns

    the response body parsed as a String using the above algorithm.

  2. abstract def bodyAsBytes: ByteString

    returns

    The response body as ByteString.

  3. abstract def bodyAsSource: Source[ByteString, _]

    returns

    the response as a source of bytes

  4. abstract def cookie(name: String): Option[WSCookie]

    Get only one cookie, using the cookie name.

  5. abstract def cookies: Seq[WSCookie]

    Get all the cookies.

  6. abstract def headers: Map[String, Seq[String]]

    Returns the current headers for this response.

  7. abstract def status: Int

    The response status code.

  8. abstract def statusText: String

    The response status message.

  9. abstract def underlying[T]: T

    Get the underlying response object.

  10. abstract def uri: URI

    Returns the URI for this response, which can differ from the request one in case of redirection.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def body[T](implicit arg0: BodyReadable[T]): T

    The response body as the given type.

    The response body as the given type. This renders as the given type. You must have a BodyReadable in implicit scope.

    The simplest use case is

    import play.api.libs.ws.StandaloneWSResponse
    import play.api.libs.ws.DefaultBodyReadables._
    
    def responseBodyAsString(response: StandaloneWSResponse): String =
      response.body[String]

    But you can also render as JSON

    // not compilable: requires `play-ws-standalone-json` dependency
    import play.api.libs.json.JsValue
    import play.api.libs.ws.StandaloneWSResponse
    
    def responseBodyAsJson(response: StandaloneWSResponse): JsValue =
      response.body[JsValue]

    or as binary:

    import org.apache.pekko.util.ByteString
    import play.api.libs.ws.StandaloneWSResponse
    import play.api.libs.ws.DefaultBodyReadables._
    
    def responseBodyAsByteString(response: StandaloneWSResponse): ByteString =
      response.body[ByteString]
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  7. def contentType: String

    returns

    the content type.

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  12. def header(name: String): Option[String]

    Get the value of the header with the specified name.

    Get the value of the header with the specified name. If there are more than one values for this header, the first value is returned. If there are no values, than a None is returned.

    name

    the header name

    returns

    the header value

  13. def headerValues(name: String): Seq[String]

    Get all the values of header with the specified name.

    Get all the values of header with the specified name. If there are no values for the header with the specified name, than an empty sequence is returned.

    name

    the header name.

    returns

    all the values for this header name.

  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped