c

play.api.libs.ws.ahc

StreamedResponse

class StreamedResponse extends StandaloneWSResponse with CookieBuilder

A streamed response containing a response header and a streamable body.

Note that this is only usable with a stream call, i.e.

import scala.concurrent.{ ExecutionContext, Future }

import org.apache.pekko.util.ByteString
import org.apache.pekko.stream.scaladsl.Source

import play.api.libs.ws.DefaultBodyReadables._
import play.api.libs.ws.ahc.StandaloneAhcWSClient

class MyClass(ws: StandaloneAhcWSClient) {
  def doIt(implicit ec: ExecutionContext): Future[String] =
    ws.url("http://example.com").stream().map { response =>
       val _ = response.body[Source[ByteString, _]]
       ??? // process source to String
    }
}
Linear Supertypes
CookieBuilder, WSCookieConverter, StandaloneWSResponse, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StreamedResponse
  2. CookieBuilder
  3. WSCookieConverter
  4. StandaloneWSResponse
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new StreamedResponse(client: StandaloneAhcWSClient, status: Int, statusText: String, uri: URI, headers: Map[String, Seq[String]], publisher: Publisher[HttpResponseBodyPart], useLaxCookieEncoder: Boolean)

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. def asCookie(c: Cookie): WSCookie
    Definition Classes
    WSCookieConverter
  5. def asCookie(cookie: WSCookie): Cookie
    Definition Classes
    WSCookieConverter
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def body[T](implicit arg0: BodyReadable[T]): T
    Definition Classes
    StandaloneWSResponse
  8. lazy val body: String

    THIS IS A BLOCKING OPERATION.

    THIS IS A BLOCKING OPERATION. It should not be used in production.

    Note that this is not a charset aware operation, as the stream does not have access to the underlying machinery that disambiguates responses.

    returns

    the body as a String

    Definition Classes
    StreamedResponse → StandaloneWSResponse
  9. lazy val bodyAsBytes: ByteString

    THIS IS A BLOCKING OPERATION.

    THIS IS A BLOCKING OPERATION. It should not be used in production.

    Note that this is not a charset aware operation, as the stream does not have access to the underlying machinery that disambiguates responses.

    returns

    the body as a ByteString

    Definition Classes
    StreamedResponse → StandaloneWSResponse
  10. lazy val bodyAsSource: Source[ByteString, _]
    Definition Classes
    StreamedResponse → StandaloneWSResponse
  11. def buildCookies(headers: Map[String, Seq[String]]): Seq[WSCookie]
    Definition Classes
    CookieBuilder
  12. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  13. def contentType: String
    Definition Classes
    StandaloneWSResponse
  14. def cookie(name: String): Option[WSCookie]

    Get only one cookie, using the cookie name.

    Get only one cookie, using the cookie name.

    Definition Classes
    StreamedResponse → StandaloneWSResponse
  15. lazy val cookies: Seq[WSCookie]

    Get all the cookies.

    Get all the cookies.

    Definition Classes
    StreamedResponse → StandaloneWSResponse
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  19. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  20. def header(name: String): Option[String]
    Definition Classes
    StandaloneWSResponse
  21. def headerValues(name: String): Seq[String]
    Definition Classes
    StandaloneWSResponse
  22. val headers: Map[String, Seq[String]]
    Definition Classes
    StreamedResponse → StandaloneWSResponse
  23. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  27. val status: Int
    Definition Classes
    StreamedResponse → StandaloneWSResponse
  28. val statusText: String
    Definition Classes
    StreamedResponse → StandaloneWSResponse
  29. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  30. def toString(): String
    Definition Classes
    AnyRef → Any
  31. def underlying[T]: T

    Get the underlying response object.

    Get the underlying response object.

    Definition Classes
    StreamedResponse → StandaloneWSResponse
  32. val uri: URI
    Definition Classes
    StreamedResponse → StandaloneWSResponse
  33. val useLaxCookieEncoder: Boolean
    Definition Classes
    StreamedResponseCookieBuilder
  34. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  35. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  36. 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 CookieBuilder

Inherited from WSCookieConverter

Inherited from StandaloneWSResponse

Inherited from AnyRef

Inherited from Any

Ungrouped