Package play.libs.ws.ahc
Class AhcWSRequest
- Object
-
- play.libs.ws.ahc.AhcWSRequest
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description WSRequest
addCookie(play.libs.ws.WSCookie cookie)
Adds a cookie to the requestWSRequest
addCookie(Http.Cookie cookie)
Adds a cookie to the requestWSRequest
addCookies(play.libs.ws.WSCookie... cookies)
Sets several cookies on the request.WSRequest
addHeader(String name, String value)
Adds a header to the request.WSRequest
addQueryParameter(String name, String value)
Sets a query parameter with the given name, this can be called repeatedly.CompletionStage<WSResponse>
delete()
Perform a DELETE on the request asynchronously.CompletionStage<WSResponse>
execute()
Execute an arbitrary method on the request asynchronously.CompletionStage<WSResponse>
execute(String method)
Execute an arbitrary method on the request asynchronously.CompletionStage<WSResponse>
get()
Perform a GET on the request asynchronously.Optional<play.libs.ws.WSAuthInfo>
getAuth()
Optional<play.libs.ws.BodyWritable>
getBody()
Optional<play.libs.ws.WSSignatureCalculator>
getCalculator()
Optional<String>
getContentType()
Optional<Boolean>
getDisableUrlEncoding()
Optional<Boolean>
getFollowRedirects()
Optional<String>
getHeader(String name)
Map<String,List<String>>
getHeaders()
List<String>
getHeaderValues(String name)
Map<String,List<String>>
getQueryParameters()
Optional<Duration>
getRequestTimeout()
String
getUrl()
CompletionStage<WSResponse>
head()
Perform a HEAD on the request asynchronously.CompletionStage<WSResponse>
options()
Perform an OPTIONS on the request asynchronously.CompletionStage<WSResponse>
patch(com.fasterxml.jackson.databind.JsonNode jsonNode)
Perform a PATCH on the request asynchronously.CompletionStage<WSResponse>
patch(File file)
Perform a PATCH on the request asynchronously.CompletionStage<WSResponse>
patch(InputStream inputStream)
Deprecated.CompletionStage<WSResponse>
patch(String string)
Perform a PATCH on the request asynchronously.CompletionStage<WSResponse>
patch(Source<? super Http.MultipartFormData.Part<Source<ByteString,?>>,?> bodyPartSource)
Perform a PATCH on the request asynchronously.CompletionStage<WSResponse>
patch(Document doc)
Perform a PATCH on the request asynchronously.CompletionStage<WSResponse>
patch(play.libs.ws.BodyWritable body)
Perform a PATCH on the request asynchronously.CompletionStage<WSResponse>
post(com.fasterxml.jackson.databind.JsonNode json)
Perform a POST on the request asynchronously.CompletionStage<WSResponse>
post(File file)
Perform a POST on the request asynchronously.CompletionStage<WSResponse>
post(InputStream is)
Deprecated.CompletionStage<WSResponse>
post(String string)
Perform a POST on the request asynchronously.CompletionStage<WSResponse>
post(Source<? super Http.MultipartFormData.Part<Source<ByteString,?>>,?> bodyPartSource)
Perform a POST on the request asynchronously.CompletionStage<WSResponse>
post(Document doc)
Perform a POST on the request asynchronously.CompletionStage<WSResponse>
post(play.libs.ws.BodyWritable body)
Perform a POST on the request asynchronously.CompletionStage<WSResponse>
put(com.fasterxml.jackson.databind.JsonNode json)
Perform a PUT on the request asynchronously.CompletionStage<WSResponse>
put(File file)
Perform a PUT on the request asynchronously.CompletionStage<WSResponse>
put(InputStream is)
Deprecated.CompletionStage<WSResponse>
put(String string)
Perform a PUT on the request asynchronously.CompletionStage<WSResponse>
put(Source<? super Http.MultipartFormData.Part<Source<ByteString,?>>,?> bodyPartSource)
Perform a PUT on the request asynchronously.CompletionStage<WSResponse>
put(Document doc)
Perform a PUT on the request asynchronously.CompletionStage<WSResponse>
put(play.libs.ws.BodyWritable body)
Perform a PUT on the request asynchronously.WSRequest
setAuth(String userInfo)
Sets the authentication header for the current request using BASIC authentication.WSRequest
setAuth(String username, String password)
Sets the authentication header for the current request using BASIC authentication.WSRequest
setAuth(String username, String password, play.libs.ws.WSAuthScheme scheme)
Sets the authentication header for the current request.play.libs.ws.StandaloneWSRequest
setAuth(play.libs.ws.WSAuthInfo authInfo)
WSRequest
setBody(com.fasterxml.jackson.databind.JsonNode json)
Set the body this request should use.WSRequest
setBody(File file)
Set the body this request should use.WSRequest
setBody(InputStream is)
Deprecated.WSRequest
setBody(String string)
Set the body this request should use.<U> WSRequest
setBody(Source<ByteString,U> source)
Set the body this request should use.WSRequest
setBody(play.libs.ws.BodyWritable bodyWritable)
Set the body this request should use.WSRequest
setContentType(String contentType)
Set the content type.WSRequest
setCookies(List<play.libs.ws.WSCookie> cookies)
Sets all the cookies on the request.WSRequest
setDisableUrlEncoding(boolean disableUrlEncoding)
WSRequest
setFollowRedirects(boolean followRedirects)
Sets whether redirects (301, 302) should be followed automatically.WSRequest
setHeader(String name, String value)
Deprecated.use addHeader(name, value)WSRequest
setHeaders(Map<String,List<String>> headers)
Sets all of the headers on the request.WSRequest
setMethod(String method)
Sets the HTTP method this request should use, where the no args execute() method is invoked.WSRequest
setQueryParameter(String name, String value)
Deprecated.Use addQueryParameterWSRequest
setQueryString(String query)
Sets the query string to query.WSRequest
setQueryString(Map<String,List<String>> params)
Sets the query string to query.WSRequest
setRequestFilter(play.libs.ws.WSRequestFilter filter)
Adds a request filter.WSRequest
setRequestTimeout(long timeout)
Deprecated.WSRequest
setRequestTimeout(Duration timeout)
Sets the request timeout in milliseconds.play.libs.ws.StandaloneWSRequest
setUrl(String url)
WSRequest
setVirtualHost(String virtualHost)
Sets the virtual host as a "hostname:port" string.WSRequest
sign(play.libs.ws.WSSignatureCalculator calculator)
Sets an (OAuth) signature calculator.CompletionStage<WSResponse>
stream()
Execute this request and stream the response body.
-
-
-
Method Detail
-
get
public CompletionStage<WSResponse> get()
Description copied from interface:WSRequest
Perform a GET on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(play.libs.ws.BodyWritable body)
Description copied from interface:WSRequest
Perform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(String string)
Description copied from interface:WSRequest
Perform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(com.fasterxml.jackson.databind.JsonNode jsonNode)
Description copied from interface:WSRequest
Perform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(Document doc)
Description copied from interface:WSRequest
Perform a PATCH on the request asynchronously.
-
patch
@Deprecated public CompletionStage<WSResponse> patch(InputStream inputStream)
Deprecated.Description copied from interface:WSRequest
Perform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(File file)
Description copied from interface:WSRequest
Perform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(Source<? super Http.MultipartFormData.Part<Source<ByteString,?>>,?> bodyPartSource)
Description copied from interface:WSRequest
Perform a PATCH on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(play.libs.ws.BodyWritable body)
Description copied from interface:WSRequest
Perform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(String string)
Description copied from interface:WSRequest
Perform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(com.fasterxml.jackson.databind.JsonNode json)
Description copied from interface:WSRequest
Perform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(Document doc)
Description copied from interface:WSRequest
Perform a POST on the request asynchronously.
-
post
@Deprecated public CompletionStage<WSResponse> post(InputStream is)
Deprecated.Description copied from interface:WSRequest
Perform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(File file)
Description copied from interface:WSRequest
Perform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(Source<? super Http.MultipartFormData.Part<Source<ByteString,?>>,?> bodyPartSource)
Description copied from interface:WSRequest
Perform a POST on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(play.libs.ws.BodyWritable body)
Description copied from interface:WSRequest
Perform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(String string)
Description copied from interface:WSRequest
Perform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(com.fasterxml.jackson.databind.JsonNode json)
Description copied from interface:WSRequest
Perform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(Document doc)
Description copied from interface:WSRequest
Perform a PUT on the request asynchronously.
-
put
@Deprecated public CompletionStage<WSResponse> put(InputStream is)
Deprecated.Description copied from interface:WSRequest
Perform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(File file)
Description copied from interface:WSRequest
Perform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(Source<? super Http.MultipartFormData.Part<Source<ByteString,?>>,?> bodyPartSource)
Description copied from interface:WSRequest
Perform a PUT on the request asynchronously.
-
delete
public CompletionStage<WSResponse> delete()
Description copied from interface:WSRequest
Perform a DELETE on the request asynchronously.
-
head
public CompletionStage<WSResponse> head()
Description copied from interface:WSRequest
Perform a HEAD on the request asynchronously.
-
options
public CompletionStage<WSResponse> options()
Description copied from interface:WSRequest
Perform an OPTIONS on the request asynchronously.
-
execute
public CompletionStage<WSResponse> execute(String method)
Description copied from interface:WSRequest
Execute an arbitrary method on the request asynchronously.
-
execute
public CompletionStage<WSResponse> execute()
Description copied from interface:WSRequest
Execute an arbitrary method on the request asynchronously. Should be used with setMethod().
-
stream
public CompletionStage<WSResponse> stream()
Description copied from interface:WSRequest
Execute this request and stream the response body.
-
setMethod
public WSRequest setMethod(String method)
Description copied from interface:WSRequest
Sets the HTTP method this request should use, where the no args execute() method is invoked.
-
setBody
public WSRequest setBody(play.libs.ws.BodyWritable bodyWritable)
Description copied from interface:WSRequest
Set the body this request should use.
-
setBody
public WSRequest setBody(String string)
Description copied from interface:WSRequest
Set the body this request should use.
-
setBody
public WSRequest setBody(com.fasterxml.jackson.databind.JsonNode json)
Description copied from interface:WSRequest
Set the body this request should use.
-
setBody
@Deprecated public WSRequest setBody(InputStream is)
Deprecated.Description copied from interface:WSRequest
Set the body this request should use.
-
setBody
public WSRequest setBody(File file)
Description copied from interface:WSRequest
Set the body this request should use.
-
setBody
public <U> WSRequest setBody(Source<ByteString,U> source)
Description copied from interface:WSRequest
Set the body this request should use.
-
setHeader
@Deprecated public WSRequest setHeader(String name, String value)
Deprecated.use addHeader(name, value)Description copied from interface:WSRequest
Adds a header to the request. Note that duplicate headers are allowed by the HTTP specification, and removing a header is not available through this API.
-
setHeaders
public WSRequest setHeaders(Map<String,List<String>> headers)
Description copied from interface:WSRequest
Sets all of the headers on the request.- Specified by:
setHeaders
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
setHeaders
in interfaceWSRequest
- Parameters:
headers
- the headers- Returns:
- the modified WSRequest.
-
addHeader
public WSRequest addHeader(String name, String value)
Description copied from interface:WSRequest
Adds a header to the request. Note that duplicate headers are allowed by the HTTP specification, and removing a header is not available through this API.
-
setQueryString
public WSRequest setQueryString(String query)
Description copied from interface:WSRequest
Sets the query string to query.- Specified by:
setQueryString
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
setQueryString
in interfaceWSRequest
- Parameters:
query
- the fully formed query string- Returns:
- the modified WSRequest.
-
setQueryParameter
@Deprecated public WSRequest setQueryParameter(String name, String value)
Deprecated.Use addQueryParameterDescription copied from interface:WSRequest
Sets a query parameter with the given name, this can be called repeatedly. Duplicate query parameters are allowed.- Specified by:
setQueryParameter
in interfaceWSRequest
- Parameters:
name
- the query parameter namevalue
- the query parameter value- Returns:
- the modified WSRequest.
-
addQueryParameter
public WSRequest addQueryParameter(String name, String value)
Description copied from interface:WSRequest
Sets a query parameter with the given name, this can be called repeatedly. Duplicate query parameters are allowed.- Specified by:
addQueryParameter
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
addQueryParameter
in interfaceWSRequest
- Parameters:
name
- the query parameter namevalue
- the query parameter value- Returns:
- the modified WSRequest.
-
setQueryString
public WSRequest setQueryString(Map<String,List<String>> params)
Description copied from interface:WSRequest
Sets the query string to query.- Specified by:
setQueryString
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
setQueryString
in interfaceWSRequest
- Parameters:
params
- the query string parameters- Returns:
- the modified WSRequest.
-
setUrl
public play.libs.ws.StandaloneWSRequest setUrl(String url)
- Specified by:
setUrl
in interfaceplay.libs.ws.StandaloneWSRequest
-
addCookie
public WSRequest addCookie(play.libs.ws.WSCookie cookie)
Description copied from interface:WSRequest
Adds a cookie to the request
-
addCookie
public WSRequest addCookie(Http.Cookie cookie)
Description copied from interface:WSRequest
Adds a cookie to the request
-
addCookies
public WSRequest addCookies(play.libs.ws.WSCookie... cookies)
Description copied from interface:WSRequest
Sets several cookies on the request.- Specified by:
addCookies
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
addCookies
in interfaceWSRequest
- Parameters:
cookies
- the cookies.- Returns:
- the modified request
-
setCookies
public WSRequest setCookies(List<play.libs.ws.WSCookie> cookies)
Description copied from interface:WSRequest
Sets all the cookies on the request.- Specified by:
setCookies
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
setCookies
in interfaceWSRequest
- Parameters:
cookies
- all the cookies.- Returns:
- the modified request
-
setAuth
public WSRequest setAuth(String userInfo)
Description copied from interface:WSRequest
Sets the authentication header for the current request using BASIC authentication.
-
setAuth
public WSRequest setAuth(String username, String password)
Description copied from interface:WSRequest
Sets the authentication header for the current request using BASIC authentication.
-
setAuth
public WSRequest setAuth(String username, String password, play.libs.ws.WSAuthScheme scheme)
Description copied from interface:WSRequest
Sets the authentication header for the current request.
-
setAuth
public play.libs.ws.StandaloneWSRequest setAuth(play.libs.ws.WSAuthInfo authInfo)
- Specified by:
setAuth
in interfaceplay.libs.ws.StandaloneWSRequest
-
sign
public WSRequest sign(play.libs.ws.WSSignatureCalculator calculator)
Description copied from interface:WSRequest
Sets an (OAuth) signature calculator.
-
setFollowRedirects
public WSRequest setFollowRedirects(boolean followRedirects)
Description copied from interface:WSRequest
Sets whether redirects (301, 302) should be followed automatically.- Specified by:
setFollowRedirects
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
setFollowRedirects
in interfaceWSRequest
- Parameters:
followRedirects
- true if the request should follow redirects- Returns:
- the modified WSRequest
-
setDisableUrlEncoding
public WSRequest setDisableUrlEncoding(boolean disableUrlEncoding)
- Specified by:
setDisableUrlEncoding
in interfaceplay.libs.ws.StandaloneWSRequest
-
setVirtualHost
public WSRequest setVirtualHost(String virtualHost)
Description copied from interface:WSRequest
Sets the virtual host as a "hostname:port" string.- Specified by:
setVirtualHost
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
setVirtualHost
in interfaceWSRequest
- Parameters:
virtualHost
- the virtual host- Returns:
- the modified WSRequest
-
setRequestTimeout
@Deprecated public WSRequest setRequestTimeout(long timeout)
Deprecated.Description copied from interface:WSRequest
Sets the request timeout in milliseconds.- Specified by:
setRequestTimeout
in interfaceWSRequest
- Parameters:
timeout
- the request timeout in milliseconds. A value of -1 indicates an infinite request timeout.- Returns:
- the modified WSRequest.
-
setRequestTimeout
public WSRequest setRequestTimeout(Duration timeout)
Description copied from interface:WSRequest
Sets the request timeout in milliseconds.- Specified by:
setRequestTimeout
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
setRequestTimeout
in interfaceWSRequest
- Parameters:
timeout
- the request timeout in milliseconds. A value of -1 indicates an infinite request timeout.- Returns:
- the modified WSRequest.
-
setRequestFilter
public WSRequest setRequestFilter(play.libs.ws.WSRequestFilter filter)
Description copied from interface:WSRequest
Adds a request filter.- Specified by:
setRequestFilter
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
setRequestFilter
in interfaceWSRequest
- Parameters:
filter
- a transforming filter.- Returns:
- the modified request.
-
setContentType
public WSRequest setContentType(String contentType)
Description copied from interface:WSRequest
Set the content type. If the request body is a String, and no charset parameter is included, then it will default to UTF-8.- Specified by:
setContentType
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
setContentType
in interfaceWSRequest
- Parameters:
contentType
- The content type- Returns:
- the modified WSRequest
-
getAuth
public Optional<play.libs.ws.WSAuthInfo> getAuth()
- Specified by:
getAuth
in interfaceplay.libs.ws.StandaloneWSRequest
-
getBody
public Optional<play.libs.ws.BodyWritable> getBody()
- Specified by:
getBody
in interfaceplay.libs.ws.StandaloneWSRequest
-
getCalculator
public Optional<play.libs.ws.WSSignatureCalculator> getCalculator()
- Specified by:
getCalculator
in interfaceplay.libs.ws.StandaloneWSRequest
-
getContentType
public Optional<String> getContentType()
- Specified by:
getContentType
in interfaceplay.libs.ws.StandaloneWSRequest
-
getFollowRedirects
public Optional<Boolean> getFollowRedirects()
- Specified by:
getFollowRedirects
in interfaceplay.libs.ws.StandaloneWSRequest
-
getDisableUrlEncoding
public Optional<Boolean> getDisableUrlEncoding()
- Specified by:
getDisableUrlEncoding
in interfaceplay.libs.ws.StandaloneWSRequest
-
getUrl
public String getUrl()
-
getHeaders
public Map<String,List<String>> getHeaders()
- Specified by:
getHeaders
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
getHeaders
in interfaceWSRequest
- Returns:
- the headers (a copy to prevent side-effects). This has not passed through an internal request builder and so will not be signed.
-
getHeaderValues
public List<String> getHeaderValues(String name)
- Specified by:
getHeaderValues
in interfaceplay.libs.ws.StandaloneWSRequest
-
getHeader
public Optional<String> getHeader(String name)
- Specified by:
getHeader
in interfaceplay.libs.ws.StandaloneWSRequest
-
getRequestTimeout
public Optional<Duration> getRequestTimeout()
- Specified by:
getRequestTimeout
in interfaceplay.libs.ws.StandaloneWSRequest
-
getQueryParameters
public Map<String,List<String>> getQueryParameters()
- Specified by:
getQueryParameters
in interfaceplay.libs.ws.StandaloneWSRequest
- Specified by:
getQueryParameters
in interfaceWSRequest
- Returns:
- the query parameters (a copy to prevent side-effects). This has not passed through an internal request builder and so will not be signed.
-
-