play.api.libs.ws

Members list

Type members

Classlikes

class BodyReadable[+R](val transform: StandaloneWSResponse => R)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object BodyReadable

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class BodyWritable[-A](val transform: A => WSBody, val contentType: String)

This is a type class pattern for writing different types of bodies to a WS request.

This is a type class pattern for writing different types of bodies to a WS request.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object BodyWritable

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

Defines common BodyReadable for a response backed by org.asynchttpclient.Response.

Defines common BodyReadable for a response backed by org.asynchttpclient.Response.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Default BodyWritable for a request body, for use with requests that take a body such as PUT, POST and PATCH.

Default BodyWritable for a request body, for use with requests that take a body such as PUT, POST and PATCH.

import scala.concurrent.ExecutionContext

import play.api.libs.ws.StandaloneWSClient
import play.api.libs.ws.DefaultBodyWritables._

class MyClass(ws: StandaloneWSClient) {
 def postBody()(implicit ec: ExecutionContext) = {
   val getBody: String = "..."
   ws.url("...").post(getBody).map { response => ??? }
 }
}

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
case class DefaultWSCookie(name: String, value: String, domain: Option[String], path: Option[String], maxAge: Option[Long], secure: Boolean, httpOnly: Boolean) extends WSCookie

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait WSCookie
class Object
trait Matchable
class Any
Show all
case class DefaultWSProxyServer(host: String, port: Int, protocol: Option[String], principal: Option[String], password: Option[String], ntlmDomain: Option[String], encoding: Option[String], nonProxyHosts: Option[Seq[String]]) extends WSProxyServer

A WS proxy.

A WS proxy.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case object EmptyBody extends WSBody

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait WSBody
class Object
trait Matchable
class Any
Show all
Self type
EmptyBody.type
case class InMemoryBody(bytes: ByteString) extends WSBody

An in memory body

An in memory body

Value parameters

bytes

The bytes of the body

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait WSBody
class Object
trait Matchable
class Any
Show all
case class SourceBody(source: Source[ByteString, _]) extends WSBody

A body containing a source of bytes

A body containing a source of bytes

Value parameters

source

A flow of the bytes of the body

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait WSBody
class Object
trait Matchable
class Any
Show all
trait StandaloneWSClient extends Closeable

The WSClient holds the configuration information needed to build a request, and provides a way to get a request holder.

The WSClient holds the configuration information needed to build a request, and provides a way to get a request holder.

Attributes

Supertypes
trait Closeable
trait AutoCloseable
class Object
trait Matchable
class Any

A WS Request builder.

A WS Request builder.

Attributes

Supertypes
class Object
trait Matchable
class Any

A WS HTTP response.

A WS HTTP response.

Attributes

Supertypes
class Object
trait Matchable
class Any
trait WSAuthScheme

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object BASIC
object DIGEST
object KERBEROS
object NTLM
object SPNEGO
object WSAuthScheme

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait WSBody

A body for the request.

A body for the request.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object EmptyBody
class InMemoryBody
class SourceBody
case class WSClientConfig(connectionTimeout: Duration, idleTimeout: Duration, requestTimeout: Duration, followRedirects: Boolean, useProxyProperties: Boolean, userAgent: Option[String], compressionEnabled: Boolean, ssl: SSLConfigSettings)

WS client config

WS client config

Value parameters

compressionEnabled

Set it to true to use gzip/deflater encoding (default is false).

connectionTimeout

The maximum time to wait when connecting to the remote host (default is 120 seconds).

followRedirects

Configures the client to follow 301 and 302 redirects (default is true).

idleTimeout

The maximum time the request can stay idle (connection is established but waiting for more data) (default is 120 seconds).

requestTimeout

The total time you accept a request to take (it will be interrupted even if the remote host is still sending data) (default is 120 seconds).

ssl

use custom SSL / TLS configuration, see https://lightbend.github.io/ssl-config/ for documentation.

useProxyProperties

To use the JVM system’s HTTP proxy settings (http.proxyHost, http.proxyPort) (default is true).

userAgent

To configure the User-Agent header field (default is None).

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
@Singleton
class WSConfigParser(config: Config, classLoader: ClassLoader) extends Provider[WSClientConfig]

This class creates a WSClientConfig object from a Typesafe Config object.

This class creates a WSClientConfig object from a Typesafe Config object.

You can create a client config from an application.conf file by running

import play.api.libs.ws.WSConfigParser
import com.typesafe.config.ConfigFactory

val wsClientConfig = new WSConfigParser(
 ConfigFactory.load(), this.getClass.getClassLoader).parse()

Attributes

Supertypes
trait Provider[WSClientConfig]
class Object
trait Matchable
class Any
trait WSCookie

A WS Cookie.

A WS Cookie.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

A WS proxy.

A WS proxy.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

A request filter. Override this trait to implement your own filters:

A request filter. Override this trait to implement your own filters:

import play.api.libs.ws.{ WSRequestFilter, WSRequestExecutor }

class HeaderAppendingFilter(key: String, value: String) extends WSRequestFilter {
 override def apply(executor: WSRequestExecutor): WSRequestExecutor = {
   WSRequestExecutor(r => executor(r.withHttpHeaders((key, value))))
 }
}

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Sign a WS call with OAuth.

Sign a WS call with OAuth.

Attributes

Supertypes
class Object
trait Matchable
class Any