public class AhcWSClient extends Object implements WSClient
See https://www.playframework.com/documentation/latest/JavaWS for documentation.
Constructor and Description |
---|
AhcWSClient(play.shaded.ahc.org.asynchttpclient.AsyncHttpClient client,
akka.stream.Materializer materializer) |
AhcWSClient(play.libs.ws.ahc.StandaloneAhcWSClient client,
akka.stream.Materializer materializer) |
Modifier and Type | Method and Description |
---|---|
play.api.libs.ws.WSClient |
asScala() |
void |
close()
Closes this client, and releases underlying resources.
|
static AhcWSClient |
create(play.api.libs.ws.ahc.AhcWSClientConfig config,
play.api.libs.ws.ahc.cache.AhcHttpCache cache,
akka.stream.Materializer materializer)
Creates WS client manually from configuration, internally creating a new instance of
AsyncHttpClient and managing its own thread pool.
|
Object |
getUnderlying()
The underlying implementation of the client, if any.
|
WSRequest |
url(String url)
Returns a WSRequest object representing the URL.
|
public AhcWSClient(play.shaded.ahc.org.asynchttpclient.AsyncHttpClient client, akka.stream.Materializer materializer)
@Inject public AhcWSClient(play.libs.ws.ahc.StandaloneAhcWSClient client, akka.stream.Materializer materializer)
public static AhcWSClient create(play.api.libs.ws.ahc.AhcWSClientConfig config, play.api.libs.ws.ahc.cache.AhcHttpCache cache, akka.stream.Materializer materializer)
This client is not managed as part of Play's lifecycle, and must be closed by calling ws.close(), otherwise you will run into memory leaks.
config
- a config object, usually from AhcWSClientConfigFactorycache
- if not null, provides HTTP caching.materializer
- an Akka materializerpublic Object getUnderlying()
WSClient
getUnderlying
in interface WSClient
public play.api.libs.ws.WSClient asScala()
public WSRequest url(String url)
WSClient
Promise<WSResponse>
.public void close() throws IOException
WSClient
Use this for manually instantiated clients.
close
in interface Closeable
close
in interface AutoCloseable
close
in interface WSClient
IOException