play.api.libs.ws.ahc

Members list

Packages

Type members

Classlikes

Builds a valid AsyncHttpClientConfig object from config.

Builds a valid AsyncHttpClientConfig object from config.

Value parameters

ahcConfig

the ahc client configuration.

Attributes

Supertypes
class Object
trait Matchable
class Any
class AhcCurlRequestLogger(logger: Logger) extends WSRequestFilter, CurlFormat

Logs StandaloneWSRequest and pulls information into Curl format to an SLF4J logger.

Logs StandaloneWSRequest and pulls information into Curl format to an SLF4J logger.

Value parameters

logger

an SLF4J logger

Attributes

See also
Companion
object
Supertypes
trait CurlFormat
trait WSRequestFilter
trait WSRequestExecutor => WSRequestExecutor
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class AhcLoggerFactory(lf: ILoggerFactory) extends LoggerFactory

Attributes

Supertypes
trait LoggerFactory
class Object
trait Matchable
class Any
trait AhcUtilities

Useful mapping code.

Useful mapping code.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class AhcWSClientConfig(wsClientConfig: WSClientConfig, maxConnectionsPerHost: Int, maxConnectionsTotal: Int, maxConnectionLifetime: Duration, idleConnectionInPoolTimeout: Duration, connectionPoolCleanerPeriod: Duration, maxNumberOfRedirects: Int, maxRequestRetry: Int, disableUrlEncoding: Boolean, keepAlive: Boolean, useLaxCookieEncoder: Boolean, useCookieStore: Boolean)

Ahc client config.

Ahc client config.

Value parameters

connectionPoolCleanerPeriod

the frequency to cleanup timeout idle connections

disableUrlEncoding

Whether the raw URL should be used.

idleConnectionInPoolTimeout

The time after which a connection that has been idle in the pool should be closed.

keepAlive

keeps thread pool active, replaces allowPoolingConnection and allowSslConnectionPool

maxConnectionLifetime

The maximum time that a connection should live for in the pool.

maxConnectionsPerHost

The maximum number of connections to make per host. -1 means no maximum.

maxConnectionsTotal

The maximum total number of connections. -1 means no maximum.

maxNumberOfRedirects

The maximum number of redirects.

maxRequestRetry

The maximum number of times to retry a request if it fails.

useLaxCookieEncoder

whether to use LAX(no cookie name/value verification) or STRICT (verifies cookie name/value) cookie decoder

wsClientConfig

The general WS client config.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Factory for creating AhcWSClientConfig, for use from Java.

Factory for creating AhcWSClientConfig, for use from Java.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
@Singleton
class AhcWSClientConfigParser(wsClientConfig: WSClientConfig, configuration: Config, classLoader: ClassLoader) extends Provider[AhcWSClientConfig]

This class creates a AhcWSClientConfig object from configuration.

This class creates a AhcWSClientConfig object from configuration.

Attributes

Supertypes
trait Provider[AhcWSClientConfig]
class Object
trait Matchable
class Any

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait CurlFormat

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class DefaultStreamedAsyncHandler[T](f: Function[StreamedState, T], streamStarted: Promise[T], streamDone: Promise[Done]) extends StreamedAsyncHandler[Unit], AhcUtilities

Attributes

Supertypes
trait AhcUtilities
trait StreamedAsyncHandler[Unit]
trait AsyncHandler[Unit]
class Object
trait Matchable
class Any
Show all
class StandaloneAhcWSClient(asyncHttpClient: AsyncHttpClient)(implicit materializer: Materializer) extends StandaloneWSClient

A WS client backed by an AsyncHttpClient.

A WS client backed by an AsyncHttpClient.

If you need to debug AsyncHttpClient, add into your conf/logback.xml file.

Value parameters

asyncHttpClient

An already configured asynchttpclient. Note that the WSClient assumes ownership of the lifecycle here, so closing the WSClient will also close asyncHttpClient.

materializer

A materializer, meant to execute the stream

Attributes

Companion
object
Supertypes
trait StandaloneWSClient
trait Closeable
trait AutoCloseable
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class StandaloneAhcWSRequest(client: StandaloneAhcWSClient, url: String, method: String, body: WSBody, headers: Map[String, Seq[String]], queryString: Map[String, Seq[String]], cookies: Seq[WSCookie], calc: Option[WSSignatureCalculator], auth: Option[(String, String, WSAuthScheme)], followRedirects: Option[Boolean], requestTimeout: Option[Duration], virtualHost: Option[String], proxyServer: Option[WSProxyServer], disableUrlEncoding: Option[Boolean], filters: Seq[WSRequestFilter])(implicit materializer: Materializer) extends StandaloneWSRequest, AhcUtilities, WSCookieConverter

A Ahc WS Request.

A Ahc WS Request.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AhcUtilities
trait StandaloneWSRequest
class Object
trait Matchable
class Any
Show all
class StandaloneAhcWSResponse(ahcResponse: Response) extends StandaloneWSResponse, DefaultBodyReadables, WSCookieConverter, AhcUtilities

A WS HTTP response backed by org.asynchttpclient.Response.

A WS HTTP response backed by org.asynchttpclient.Response.

Attributes

Companion
object
Supertypes
trait AhcUtilities
trait DefaultBodyReadables
trait StandaloneWSResponse
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class StreamedResponse(client: StandaloneAhcWSClient, val status: Int, val statusText: String, val uri: URI, publisher: Publisher[HttpResponseBodyPart], val useLaxCookieEncoder: Boolean) extends StandaloneWSResponse, CookieBuilder

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

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
   }
}

Attributes

Supertypes
trait StandaloneWSResponse
class Object
trait Matchable
class Any
Show all
case class StreamedState(statusCode: Int, statusText: String, uriOption: Option[URI], responseHeaders: Map[String, Seq[String]], publisher: Publisher[HttpResponseBodyPart])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Converts between AHC cookie and the WS cookie.

Converts between AHC cookie and the WS cookie.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes