AhcWSResponse
A WS HTTP Response backed by an AsyncHttpClient response.
Value parameters
- underlying
-
the underlying WS response
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait WSResponsetrait WSBodyReadablestrait XMLBodyReadablestrait JsonBodyReadablestrait DefaultBodyReadablestrait StandaloneWSResponseclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Constructors
Concrete methods
The response body as String.
The response body as a byte string.
The response body as a byte string.
Attributes
- Definition Classes
-
WSResponse -> StandaloneWSResponse
Attributes
- Returns
-
the response as a source of bytes
- Definition Classes
-
WSResponse -> StandaloneWSResponse
Get only one cookie, using the cookie name.
Get only one cookie, using the cookie name.
Attributes
- Definition Classes
-
WSResponse -> StandaloneWSResponse
Get all the cookies.
Get a response header.
Return the current headers of the request being constructed
Return the current headers of the request being constructed
Attributes
- Definition Classes
-
WSResponse -> StandaloneWSResponse
The response status code.
The response status message.
Get the underlying response object, i.e. play.shaded.ahc.org.asynchttpclient.Response
Get the underlying response object, i.e. play.shaded.ahc.org.asynchttpclient.Response
val ahcResponse = response.underlying[play.shaded.ahc.org.asynchttpclient.Response]
Attributes
- Definition Classes
-
WSResponse -> StandaloneWSResponse
Returns the URI for this response, which can differ from the request one in case of redirection.
Returns the URI for this response, which can differ from the request one in case of redirection.
Attributes
- Definition Classes
-
StandaloneWSResponse
Deprecated methods
Return the current headers of the request being constructed
Return the current headers of the request being constructed
Attributes
- Deprecated
-
[Since version 2.6.0]
- Definition Classes
The response body as Json.
The response body as Json.
Attributes
- Deprecated
-
[Since version 2.6.0]
- Definition Classes
The response body as Xml.
Inherited methods
The response body as the given type. This renders as the given type. You must have a BodyReadable in implicit scope, which is done with
The response body as the given type. This renders as the given type. You must have a BodyReadable in implicit scope, which is done with
class MyClass extends play.api.libs.ws.WSBodyReadables {
// JSON and XML body readables
}
The simplest use case is
val responseBodyAsString: String = response.body[String]
But you can also render as JSON
val responseBodyAsJson: JsValue = response.body[JsValue]
or as XML:
val xml: Elem = response.body[Elem]
Attributes
- Definition Classes
-
WSResponse -> StandaloneWSResponse
- Inherited from:
- WSResponse
Attributes
- Returns
-
the content type.
- Definition Classes
-
WSResponse -> StandaloneWSResponse
- Inherited from:
- WSResponse
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.
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.
Value parameters
- name
-
the header name.
Attributes
- Returns
-
all the values for this header name.
- Definition Classes
-
WSResponse -> StandaloneWSResponse
- Inherited from:
- WSResponse
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product
Implicits
Inherited implicits
Converts a response body into Array[Byte]
.
Converts a response body into Array[Byte]
.
import play.api.libs.ws.DefaultBodyReadables._
def example(response: play.api.libs.ws.StandaloneWSResponse): Array[Byte] =
response.body[Array[Byte]]
Attributes
- Inherited from:
- DefaultBodyReadables
Converts a response body into a read only ByteBuffer
.
Converts a response body into a read only ByteBuffer
.
import java.nio.ByteBuffer
import play.api.libs.ws.DefaultBodyReadables._
def example(response: play.api.libs.ws.StandaloneWSResponse): ByteBuffer =
response.body[ByteBuffer]
Attributes
- Inherited from:
- DefaultBodyReadables
Converts a response body into an akka.util.ByteString
:
Converts a response body into an akka.util.ByteString
:
import akka.util.ByteString
import play.api.libs.ws.DefaultBodyReadables._
def example(response: play.api.libs.ws.StandaloneWSResponse): ByteString =
response.body[ByteString]
Attributes
- Inherited from:
- DefaultBodyReadables
Converts a response body into Play JSON format:
Converts a response body into Play JSON format:
import play.api.libs.ws.StandaloneWSResponse
import play.api.libs.ws.JsonBodyReadables._
def json(r: StandaloneWSResponse) = r.body[play.api.libs.json.JsValue]
Attributes
- Inherited from:
- JsonBodyReadables
Converts a response body into Source[ByteString, _]
.
Converts a response body into Source[ByteString, _]
.
Attributes
- Inherited from:
- DefaultBodyReadables
Converts a response body into a String
.
Converts a response body into a String
.
Note: this is only a best-guess effort and does not handle all content types. See StandaloneWSResponse.body:String* for more information.
import play.api.libs.ws.DefaultBodyReadables._
def example(response: play.api.libs.ws.StandaloneWSResponse): String =
response.body[String]
Attributes
- Inherited from:
- DefaultBodyReadables
Converts a response body into XML document:
Converts a response body into XML document:
import scala.xml.Elem
import play.api.libs.ws.StandaloneWSResponse
import play.api.libs.ws.XMLBodyReadables._
def foo(resp: StandaloneWSResponse): Elem = resp.body[Elem]
Attributes
- Inherited from:
- XMLBodyReadables