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 WSRequestaddCookie(play.libs.ws.WSCookie cookie)Adds a cookie to the requestWSRequestaddCookie(Http.Cookie cookie)Adds a cookie to the requestWSRequestaddCookies(play.libs.ws.WSCookie... cookies)Sets several cookies on the request.WSRequestaddHeader(String name, String value)Adds a header to the request.WSRequestaddQueryParameter(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()StringgetUrl()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.WSRequestsetAuth(String userInfo)Sets the authentication header for the current request using BASIC authentication.WSRequestsetAuth(String username, String password)Sets the authentication header for the current request using BASIC authentication.WSRequestsetAuth(String username, String password, play.libs.ws.WSAuthScheme scheme)Sets the authentication header for the current request.play.libs.ws.StandaloneWSRequestsetAuth(play.libs.ws.WSAuthInfo authInfo)WSRequestsetBody(com.fasterxml.jackson.databind.JsonNode json)Set the body this request should use.WSRequestsetBody(File file)Set the body this request should use.WSRequestsetBody(InputStream is)Deprecated.WSRequestsetBody(String string)Set the body this request should use.<U> WSRequestsetBody(Source<ByteString,U> source)Set the body this request should use.WSRequestsetBody(play.libs.ws.BodyWritable bodyWritable)Set the body this request should use.WSRequestsetContentType(String contentType)Set the content type.WSRequestsetCookies(List<play.libs.ws.WSCookie> cookies)Sets all the cookies on the request.WSRequestsetDisableUrlEncoding(boolean disableUrlEncoding)WSRequestsetFollowRedirects(boolean followRedirects)Sets whether redirects (301, 302) should be followed automatically.WSRequestsetHeader(String name, String value)Deprecated.use addHeader(name, value)WSRequestsetHeaders(Map<String,List<String>> headers)Sets all of the headers on the request.WSRequestsetMethod(String method)Sets the HTTP method this request should use, where the no args execute() method is invoked.WSRequestsetQueryParameter(String name, String value)Deprecated.Use addQueryParameterWSRequestsetQueryString(String query)Sets the query string to query.WSRequestsetQueryString(Map<String,List<String>> params)Sets the query string to query.WSRequestsetRequestFilter(play.libs.ws.WSRequestFilter filter)Adds a request filter.WSRequestsetRequestTimeout(long timeout)Deprecated.WSRequestsetRequestTimeout(Duration timeout)Sets the request timeout in milliseconds.play.libs.ws.StandaloneWSRequestsetUrl(String url)WSRequestsetVirtualHost(String virtualHost)Sets the virtual host as a "hostname:port" string.WSRequestsign(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:WSRequestPerform a GET on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(play.libs.ws.BodyWritable body)
Description copied from interface:WSRequestPerform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(String string)
Description copied from interface:WSRequestPerform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(com.fasterxml.jackson.databind.JsonNode jsonNode)
Description copied from interface:WSRequestPerform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(Document doc)
Description copied from interface:WSRequestPerform a PATCH on the request asynchronously.
-
patch
@Deprecated public CompletionStage<WSResponse> patch(InputStream inputStream)
Deprecated.Description copied from interface:WSRequestPerform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(File file)
Description copied from interface:WSRequestPerform a PATCH on the request asynchronously.
-
patch
public CompletionStage<WSResponse> patch(Source<? super Http.MultipartFormData.Part<Source<ByteString,?>>,?> bodyPartSource)
Description copied from interface:WSRequestPerform a PATCH on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(play.libs.ws.BodyWritable body)
Description copied from interface:WSRequestPerform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(String string)
Description copied from interface:WSRequestPerform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(com.fasterxml.jackson.databind.JsonNode json)
Description copied from interface:WSRequestPerform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(Document doc)
Description copied from interface:WSRequestPerform a POST on the request asynchronously.
-
post
@Deprecated public CompletionStage<WSResponse> post(InputStream is)
Deprecated.Description copied from interface:WSRequestPerform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(File file)
Description copied from interface:WSRequestPerform a POST on the request asynchronously.
-
post
public CompletionStage<WSResponse> post(Source<? super Http.MultipartFormData.Part<Source<ByteString,?>>,?> bodyPartSource)
Description copied from interface:WSRequestPerform a POST on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(play.libs.ws.BodyWritable body)
Description copied from interface:WSRequestPerform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(String string)
Description copied from interface:WSRequestPerform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(com.fasterxml.jackson.databind.JsonNode json)
Description copied from interface:WSRequestPerform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(Document doc)
Description copied from interface:WSRequestPerform a PUT on the request asynchronously.
-
put
@Deprecated public CompletionStage<WSResponse> put(InputStream is)
Deprecated.Description copied from interface:WSRequestPerform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(File file)
Description copied from interface:WSRequestPerform a PUT on the request asynchronously.
-
put
public CompletionStage<WSResponse> put(Source<? super Http.MultipartFormData.Part<Source<ByteString,?>>,?> bodyPartSource)
Description copied from interface:WSRequestPerform a PUT on the request asynchronously.
-
delete
public CompletionStage<WSResponse> delete()
Description copied from interface:WSRequestPerform a DELETE on the request asynchronously.
-
head
public CompletionStage<WSResponse> head()
Description copied from interface:WSRequestPerform a HEAD on the request asynchronously.
-
options
public CompletionStage<WSResponse> options()
Description copied from interface:WSRequestPerform an OPTIONS on the request asynchronously.
-
execute
public CompletionStage<WSResponse> execute(String method)
Description copied from interface:WSRequestExecute an arbitrary method on the request asynchronously.
-
execute
public CompletionStage<WSResponse> execute()
Description copied from interface:WSRequestExecute an arbitrary method on the request asynchronously. Should be used with setMethod().
-
stream
public CompletionStage<WSResponse> stream()
Description copied from interface:WSRequestExecute this request and stream the response body.
-
setMethod
public WSRequest setMethod(String method)
Description copied from interface:WSRequestSets 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:WSRequestSet the body this request should use.
-
setBody
public WSRequest setBody(String string)
Description copied from interface:WSRequestSet the body this request should use.
-
setBody
public WSRequest setBody(com.fasterxml.jackson.databind.JsonNode json)
Description copied from interface:WSRequestSet the body this request should use.
-
setBody
@Deprecated public WSRequest setBody(InputStream is)
Deprecated.Description copied from interface:WSRequestSet the body this request should use.
-
setBody
public WSRequest setBody(File file)
Description copied from interface:WSRequestSet the body this request should use.
-
setBody
public <U> WSRequest setBody(Source<ByteString,U> source)
Description copied from interface:WSRequestSet the body this request should use.
-
setHeader
@Deprecated public WSRequest setHeader(String name, String value)
Deprecated.use addHeader(name, value)Description copied from interface:WSRequestAdds 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:WSRequestSets all of the headers on the request.- Specified by:
setHeadersin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
setHeadersin interfaceWSRequest- Parameters:
headers- the headers- Returns:
- the modified WSRequest.
-
addHeader
public WSRequest addHeader(String name, String value)
Description copied from interface:WSRequestAdds 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:WSRequestSets the query string to query.- Specified by:
setQueryStringin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
setQueryStringin 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:WSRequestSets a query parameter with the given name, this can be called repeatedly. Duplicate query parameters are allowed.- Specified by:
setQueryParameterin 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:WSRequestSets a query parameter with the given name, this can be called repeatedly. Duplicate query parameters are allowed.- Specified by:
addQueryParameterin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
addQueryParameterin 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:WSRequestSets the query string to query.- Specified by:
setQueryStringin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
setQueryStringin interfaceWSRequest- Parameters:
params- the query string parameters- Returns:
- the modified WSRequest.
-
setUrl
public play.libs.ws.StandaloneWSRequest setUrl(String url)
- Specified by:
setUrlin interfaceplay.libs.ws.StandaloneWSRequest
-
addCookie
public WSRequest addCookie(play.libs.ws.WSCookie cookie)
Description copied from interface:WSRequestAdds a cookie to the request
-
addCookie
public WSRequest addCookie(Http.Cookie cookie)
Description copied from interface:WSRequestAdds a cookie to the request
-
addCookies
public WSRequest addCookies(play.libs.ws.WSCookie... cookies)
Description copied from interface:WSRequestSets several cookies on the request.- Specified by:
addCookiesin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
addCookiesin interfaceWSRequest- Parameters:
cookies- the cookies.- Returns:
- the modified request
-
setCookies
public WSRequest setCookies(List<play.libs.ws.WSCookie> cookies)
Description copied from interface:WSRequestSets all the cookies on the request.- Specified by:
setCookiesin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
setCookiesin interfaceWSRequest- Parameters:
cookies- all the cookies.- Returns:
- the modified request
-
setAuth
public WSRequest setAuth(String userInfo)
Description copied from interface:WSRequestSets the authentication header for the current request using BASIC authentication.
-
setAuth
public WSRequest setAuth(String username, String password)
Description copied from interface:WSRequestSets 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:WSRequestSets the authentication header for the current request.
-
setAuth
public play.libs.ws.StandaloneWSRequest setAuth(play.libs.ws.WSAuthInfo authInfo)
- Specified by:
setAuthin interfaceplay.libs.ws.StandaloneWSRequest
-
sign
public WSRequest sign(play.libs.ws.WSSignatureCalculator calculator)
Description copied from interface:WSRequestSets an (OAuth) signature calculator.
-
setFollowRedirects
public WSRequest setFollowRedirects(boolean followRedirects)
Description copied from interface:WSRequestSets whether redirects (301, 302) should be followed automatically.- Specified by:
setFollowRedirectsin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
setFollowRedirectsin interfaceWSRequest- Parameters:
followRedirects- true if the request should follow redirects- Returns:
- the modified WSRequest
-
setDisableUrlEncoding
public WSRequest setDisableUrlEncoding(boolean disableUrlEncoding)
- Specified by:
setDisableUrlEncodingin interfaceplay.libs.ws.StandaloneWSRequest
-
setVirtualHost
public WSRequest setVirtualHost(String virtualHost)
Description copied from interface:WSRequestSets the virtual host as a "hostname:port" string.- Specified by:
setVirtualHostin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
setVirtualHostin interfaceWSRequest- Parameters:
virtualHost- the virtual host- Returns:
- the modified WSRequest
-
setRequestTimeout
@Deprecated public WSRequest setRequestTimeout(long timeout)
Deprecated.Description copied from interface:WSRequestSets the request timeout in milliseconds.- Specified by:
setRequestTimeoutin 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:WSRequestSets the request timeout in milliseconds.- Specified by:
setRequestTimeoutin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
setRequestTimeoutin 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:WSRequestAdds a request filter.- Specified by:
setRequestFilterin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
setRequestFilterin interfaceWSRequest- Parameters:
filter- a transforming filter.- Returns:
- the modified request.
-
setContentType
public WSRequest setContentType(String contentType)
Description copied from interface:WSRequestSet 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:
setContentTypein interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
setContentTypein interfaceWSRequest- Parameters:
contentType- The content type- Returns:
- the modified WSRequest
-
getAuth
public Optional<play.libs.ws.WSAuthInfo> getAuth()
- Specified by:
getAuthin interfaceplay.libs.ws.StandaloneWSRequest
-
getBody
public Optional<play.libs.ws.BodyWritable> getBody()
- Specified by:
getBodyin interfaceplay.libs.ws.StandaloneWSRequest
-
getCalculator
public Optional<play.libs.ws.WSSignatureCalculator> getCalculator()
- Specified by:
getCalculatorin interfaceplay.libs.ws.StandaloneWSRequest
-
getContentType
public Optional<String> getContentType()
- Specified by:
getContentTypein interfaceplay.libs.ws.StandaloneWSRequest
-
getFollowRedirects
public Optional<Boolean> getFollowRedirects()
- Specified by:
getFollowRedirectsin interfaceplay.libs.ws.StandaloneWSRequest
-
getDisableUrlEncoding
public Optional<Boolean> getDisableUrlEncoding()
- Specified by:
getDisableUrlEncodingin interfaceplay.libs.ws.StandaloneWSRequest
-
getUrl
public String getUrl()
-
getHeaders
public Map<String,List<String>> getHeaders()
- Specified by:
getHeadersin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
getHeadersin 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:
getHeaderValuesin interfaceplay.libs.ws.StandaloneWSRequest
-
getHeader
public Optional<String> getHeader(String name)
- Specified by:
getHeaderin interfaceplay.libs.ws.StandaloneWSRequest
-
getRequestTimeout
public Optional<Duration> getRequestTimeout()
- Specified by:
getRequestTimeoutin interfaceplay.libs.ws.StandaloneWSRequest
-
getQueryParameters
public Map<String,List<String>> getQueryParameters()
- Specified by:
getQueryParametersin interfaceplay.libs.ws.StandaloneWSRequest- Specified by:
getQueryParametersin 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.
-
-