public interface WSRequest
extends play.libs.ws.StandaloneWSRequest
Note that this interface does not expose properties that are only exposed after building the request: notably, the URL, headers and query parameters are shown before an OAuth signature is calculated.
Modifier and Type | Method and Description |
---|---|
WSRequest |
addCookie(Http.Cookie cookie)
Adds a cookie to the request
|
WSRequest |
addCookie(play.libs.ws.WSCookie cookie)
Adds a cookie to the request
|
WSRequest |
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.
|
Map<String,List<String>> |
getHeaders() |
Map<String,List<String>> |
getQueryParameters() |
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(play.libs.ws.BodyWritable body)
Perform a PATCH on the request asynchronously.
|
CompletionStage<WSResponse> |
patch(Document body)
Perform a PATCH on the request asynchronously.
|
CompletionStage<WSResponse> |
patch(File body)
Perform a PATCH on the request asynchronously.
|
CompletionStage<WSResponse> |
patch(InputStream body)
Deprecated.
Deprecated as of 2.7.0. Use
patch(BodyWritable) instead. |
CompletionStage<WSResponse> |
patch(com.fasterxml.jackson.databind.JsonNode body)
Perform a PATCH on the request asynchronously.
|
CompletionStage<WSResponse> |
patch(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
Perform a PATCH on the request asynchronously.
|
CompletionStage<WSResponse> |
patch(String body)
Perform a PATCH on the request asynchronously.
|
CompletionStage<WSResponse> |
post(play.libs.ws.BodyWritable body)
Perform a POST on the request asynchronously.
|
CompletionStage<WSResponse> |
post(Document body)
Perform a POST on the request asynchronously.
|
CompletionStage<WSResponse> |
post(File body)
Perform a POST on the request asynchronously.
|
CompletionStage<WSResponse> |
post(InputStream body)
Deprecated.
Deprecated as of 2.6.0. Use
post(BodyWritable) instead. |
CompletionStage<WSResponse> |
post(com.fasterxml.jackson.databind.JsonNode body)
Perform a POST on the request asynchronously.
|
CompletionStage<WSResponse> |
post(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
Perform a POST on the request asynchronously.
|
CompletionStage<WSResponse> |
post(String body)
Perform a POST on the request asynchronously.
|
CompletionStage<WSResponse> |
put(play.libs.ws.BodyWritable body)
Perform a PUT on the request asynchronously.
|
CompletionStage<WSResponse> |
put(Document body)
Perform a PUT on the request asynchronously.
|
CompletionStage<WSResponse> |
put(File body)
Perform a PUT on the request asynchronously.
|
CompletionStage<WSResponse> |
put(InputStream body)
Deprecated.
Deprecated as of 2.7.0. Use
put(BodyWritable) instead. |
CompletionStage<WSResponse> |
put(com.fasterxml.jackson.databind.JsonNode body)
Perform a PUT on the request asynchronously.
|
CompletionStage<WSResponse> |
put(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
Perform a PUT on the request asynchronously.
|
CompletionStage<WSResponse> |
put(String 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.
|
WSRequest |
setBody(play.libs.ws.BodyWritable body)
Set the body this request should use.
|
WSRequest |
setBody(File body)
Set the body this request should use.
|
WSRequest |
setBody(InputStream body)
Deprecated.
Deprecated as of 2.6.0. Use
setBody(BodyWritable) instead. |
WSRequest |
setBody(com.fasterxml.jackson.databind.JsonNode body)
Set the body this request should use.
|
<U> WSRequest |
setBody(akka.stream.javadsl.Source<akka.util.ByteString,U> body)
Set the body this request should use.
|
WSRequest |
setBody(String body)
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 |
setFollowRedirects(boolean followRedirects)
Sets whether redirects (301, 302) should be followed automatically.
|
WSRequest |
setHeader(String name,
String value)
Deprecated.
|
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.
|
WSRequest |
setQueryString(Map<String,List<String>> params)
Sets the query string to query.
|
WSRequest |
setQueryString(String query)
Sets the query string to query.
|
WSRequest |
setRequestFilter(play.libs.ws.WSRequestFilter filter)
Adds a request filter.
|
WSRequest |
setRequestTimeout(Duration timeout)
Sets the request timeout in milliseconds.
|
WSRequest |
setRequestTimeout(long timeout)
Deprecated.
|
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.
|
CompletionStage<WSResponse> get()
get
in interface play.libs.ws.StandaloneWSRequest
CompletionStage<WSResponse> patch(play.libs.ws.BodyWritable body)
patch
in interface play.libs.ws.StandaloneWSRequest
body
- represented as BodyWritableCompletionStage<WSResponse> patch(String body)
body
- represented as StringCompletionStage<WSResponse> patch(com.fasterxml.jackson.databind.JsonNode body)
body
- represented as JSONCompletionStage<WSResponse> patch(Document body)
body
- represented as a Document@Deprecated CompletionStage<WSResponse> patch(InputStream body)
patch(BodyWritable)
instead.body
- represented as an InputStreamCompletionStage<WSResponse> patch(File body)
body
- represented as a FileCompletionStage<WSResponse> patch(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
body
- represented as a MultipartFormData.PartCompletionStage<WSResponse> post(play.libs.ws.BodyWritable body)
post
in interface play.libs.ws.StandaloneWSRequest
body
- represented as body writableCompletionStage<WSResponse> post(String body)
body
- represented as StringCompletionStage<WSResponse> post(com.fasterxml.jackson.databind.JsonNode body)
body
- represented as JSONCompletionStage<WSResponse> post(Document body)
body
- represented as a Document@Deprecated CompletionStage<WSResponse> post(InputStream body)
post(BodyWritable)
instead.body
- represented as an InputStreamCompletionStage<WSResponse> post(File body)
body
- represented as a FileCompletionStage<WSResponse> post(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
body
- represented as a MultipartFormData.PartCompletionStage<WSResponse> put(play.libs.ws.BodyWritable body)
put
in interface play.libs.ws.StandaloneWSRequest
body
- represented as BodyWritableCompletionStage<WSResponse> put(String body)
body
- represented as StringCompletionStage<WSResponse> put(com.fasterxml.jackson.databind.JsonNode body)
body
- represented as JSONCompletionStage<WSResponse> put(Document body)
body
- represented as a Document@Deprecated CompletionStage<WSResponse> put(InputStream body)
put(BodyWritable)
instead.body
- represented as an InputStreamCompletionStage<WSResponse> put(File body)
body
- represented as a FileCompletionStage<WSResponse> put(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
body
- represented as a MultipartFormData.PartCompletionStage<WSResponse> delete()
delete
in interface play.libs.ws.StandaloneWSRequest
CompletionStage<WSResponse> head()
head
in interface play.libs.ws.StandaloneWSRequest
CompletionStage<WSResponse> options()
options
in interface play.libs.ws.StandaloneWSRequest
CompletionStage<WSResponse> execute(String method)
execute
in interface play.libs.ws.StandaloneWSRequest
method
- The method to executeCompletionStage<WSResponse> execute()
execute
in interface play.libs.ws.StandaloneWSRequest
CompletionStage<WSResponse> stream()
stream
in interface play.libs.ws.StandaloneWSRequest
WSRequest setMethod(String method)
setMethod
in interface play.libs.ws.StandaloneWSRequest
method
- the HTTP method.WSRequest setBody(play.libs.ws.BodyWritable body)
setBody
in interface play.libs.ws.StandaloneWSRequest
body
- the body of the request.WSRequest setBody(String body)
body
- the body of the request.WSRequest setBody(com.fasterxml.jackson.databind.JsonNode body)
body
- the body of the request.@Deprecated WSRequest setBody(InputStream body)
setBody(BodyWritable)
instead.body
- the request body.WSRequest setBody(File body)
body
- the body of the request.<U> WSRequest setBody(akka.stream.javadsl.Source<akka.util.ByteString,U> body)
body
- the body of the request.WSRequest addHeader(String name, String value)
addHeader
in interface play.libs.ws.StandaloneWSRequest
name
- the header namevalue
- the header value@Deprecated WSRequest setHeader(String name, String value)
addHeader(String, String)
name
- the header namevalue
- the header valueWSRequest setHeaders(Map<String,List<String>> headers)
setHeaders
in interface play.libs.ws.StandaloneWSRequest
headers
- the headersWSRequest setQueryString(String query)
setQueryString
in interface play.libs.ws.StandaloneWSRequest
query
- the fully formed query stringWSRequest setQueryString(Map<String,List<String>> params)
setQueryString
in interface play.libs.ws.StandaloneWSRequest
params
- the query string parametersWSRequest addQueryParameter(String name, String value)
addQueryParameter
in interface play.libs.ws.StandaloneWSRequest
name
- the query parameter namevalue
- the query parameter value@Deprecated WSRequest setQueryParameter(String name, String value)
addQueryParameter(String, String)
name
- the query parameter namevalue
- the query parameter valueWSRequest addCookie(play.libs.ws.WSCookie cookie)
addCookie
in interface play.libs.ws.StandaloneWSRequest
cookie
- the cookie to add.WSRequest addCookie(Http.Cookie cookie)
cookie
- the cookie to add.WSRequest addCookies(play.libs.ws.WSCookie... cookies)
addCookies
in interface play.libs.ws.StandaloneWSRequest
cookies
- the cookies.WSRequest setCookies(List<play.libs.ws.WSCookie> cookies)
setCookies
in interface play.libs.ws.StandaloneWSRequest
cookies
- all the cookies.WSRequest setAuth(String userInfo)
setAuth
in interface play.libs.ws.StandaloneWSRequest
userInfo
- a string formed as "username:password".WSRequest setAuth(String username, String password)
setAuth
in interface play.libs.ws.StandaloneWSRequest
username
- the basic auth usernamepassword
- the basic auth passwordWSRequest setAuth(String username, String password, play.libs.ws.WSAuthScheme scheme)
setAuth
in interface play.libs.ws.StandaloneWSRequest
username
- the usernamepassword
- the passwordscheme
- authentication schemeWSRequest sign(play.libs.ws.WSSignatureCalculator calculator)
sign
in interface play.libs.ws.StandaloneWSRequest
calculator
- the signature calculatorWSRequest setFollowRedirects(boolean followRedirects)
setFollowRedirects
in interface play.libs.ws.StandaloneWSRequest
followRedirects
- true if the request should follow redirectsWSRequest setVirtualHost(String virtualHost)
setVirtualHost
in interface play.libs.ws.StandaloneWSRequest
virtualHost
- the virtual hostWSRequest setRequestTimeout(Duration timeout)
setRequestTimeout
in interface play.libs.ws.StandaloneWSRequest
timeout
- the request timeout in milliseconds. A value of -1 indicates an infinite request
timeout.@Deprecated WSRequest setRequestTimeout(long timeout)
setRequestTimeout(Duration)
timeout
- the request timeout in milliseconds. A value of -1 indicates an infinite request
timeout.WSRequest setRequestFilter(play.libs.ws.WSRequestFilter filter)
setRequestFilter
in interface play.libs.ws.StandaloneWSRequest
filter
- a transforming filter.WSRequest setContentType(String contentType)
setContentType
in interface play.libs.ws.StandaloneWSRequest
contentType
- The content typeString getUrl()
getUrl
in interface play.libs.ws.StandaloneWSRequest
Map<String,List<String>> getHeaders()
getHeaders
in interface play.libs.ws.StandaloneWSRequest