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(java.lang.String name,
java.lang.String value)
Adds a header to the request.
|
WSRequest |
addQueryParameter(java.lang.String name,
java.lang.String value)
Sets a query parameter with the given name, this can be called repeatedly.
|
java.util.concurrent.CompletionStage<WSResponse> |
delete()
Perform a DELETE on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
execute()
Execute an arbitrary method on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
execute(java.lang.String method)
Execute an arbitrary method on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
get()
Perform a GET on the request asynchronously.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getHeaders() |
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getQueryParameters() |
java.lang.String |
getUrl() |
java.util.concurrent.CompletionStage<WSResponse> |
head()
Perform a HEAD on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
options()
Perform an OPTIONS on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
patch(play.libs.ws.BodyWritable body)
Perform a PATCH on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
patch(org.w3c.dom.Document body)
Perform a PATCH on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
patch(java.io.File body)
Perform a PATCH on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
patch(java.io.InputStream body)
Perform a PATCH on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
patch(com.fasterxml.jackson.databind.JsonNode body)
Perform a PATCH on the request asynchronously.
|
java.util.concurrent.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.
|
java.util.concurrent.CompletionStage<WSResponse> |
patch(java.lang.String body)
Perform a PATCH on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
post(play.libs.ws.BodyWritable body)
Perform a POST on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
post(org.w3c.dom.Document body)
Perform a POST on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
post(java.io.File body)
Perform a POST on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
post(java.io.InputStream body)
Deprecated.
|
java.util.concurrent.CompletionStage<WSResponse> |
post(com.fasterxml.jackson.databind.JsonNode body)
Perform a POST on the request asynchronously.
|
java.util.concurrent.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.
|
java.util.concurrent.CompletionStage<WSResponse> |
post(java.lang.String body)
Perform a POST on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
put(play.libs.ws.BodyWritable body)
Perform a PUT on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
put(org.w3c.dom.Document body)
Perform a PUT on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
put(java.io.File body)
Perform a PUT on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
put(java.io.InputStream body)
Perform a PUT on the request asynchronously.
|
java.util.concurrent.CompletionStage<WSResponse> |
put(com.fasterxml.jackson.databind.JsonNode body)
Perform a PUT on the request asynchronously.
|
java.util.concurrent.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.
|
java.util.concurrent.CompletionStage<WSResponse> |
put(java.lang.String body)
Perform a PUT on the request asynchronously.
|
WSRequest |
setAuth(java.lang.String userInfo)
Sets the authentication header for the current request using BASIC authentication.
|
WSRequest |
setAuth(java.lang.String username,
java.lang.String password)
Sets the authentication header for the current request using BASIC authentication.
|
WSRequest |
setAuth(java.lang.String username,
java.lang.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(java.io.File body)
Set the body this request should use.
|
WSRequest |
setBody(java.io.InputStream body)
Deprecated.
|
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(java.lang.String body)
Set the body this request should use.
|
WSRequest |
setContentType(java.lang.String contentType)
Set the content type.
|
WSRequest |
setCookies(java.util.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(java.lang.String name,
java.lang.String value)
Deprecated.
|
WSRequest |
setHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
Sets all of the headers on the request.
|
WSRequest |
setMethod(java.lang.String method)
Sets the HTTP method this request should use, where the no args execute() method is invoked.
|
WSRequest |
setQueryParameter(java.lang.String name,
java.lang.String value)
Deprecated.
|
WSRequest |
setQueryString(java.util.Map<java.lang.String,java.util.List<java.lang.String>> params)
Sets the query string to query.
|
WSRequest |
setQueryString(java.lang.String query)
Sets the query string to query.
|
WSRequest |
setRequestFilter(play.libs.ws.WSRequestFilter filter)
Adds a request filter.
|
WSRequest |
setRequestTimeout(java.time.Duration timeout)
Sets the request timeout in milliseconds.
|
WSRequest |
setRequestTimeout(long timeout)
Deprecated.
|
WSRequest |
setVirtualHost(java.lang.String virtualHost)
Sets the virtual host as a "hostname:port" string.
|
WSRequest |
sign(play.libs.ws.WSSignatureCalculator calculator)
Sets an (OAuth) signature calculator.
|
java.util.concurrent.CompletionStage<WSResponse> |
stream()
Execute this request and stream the response body.
|
java.util.concurrent.CompletionStage<WSResponse> get()
get
in interface play.libs.ws.StandaloneWSRequest
java.util.concurrent.CompletionStage<WSResponse> patch(play.libs.ws.BodyWritable body)
patch
in interface play.libs.ws.StandaloneWSRequest
body
- represented as BodyWritablejava.util.concurrent.CompletionStage<WSResponse> patch(java.lang.String body)
body
- represented as Stringjava.util.concurrent.CompletionStage<WSResponse> patch(com.fasterxml.jackson.databind.JsonNode body)
body
- represented as JSONjava.util.concurrent.CompletionStage<WSResponse> patch(org.w3c.dom.Document body)
body
- represented as a Documentjava.util.concurrent.CompletionStage<WSResponse> patch(java.io.InputStream body)
body
- represented as an InputStreamjava.util.concurrent.CompletionStage<WSResponse> patch(java.io.File body)
body
- represented as a Filejava.util.concurrent.CompletionStage<WSResponse> patch(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
body
- represented as a MultipartFormData.Partjava.util.concurrent.CompletionStage<WSResponse> post(play.libs.ws.BodyWritable body)
post
in interface play.libs.ws.StandaloneWSRequest
body
- represented as body writablejava.util.concurrent.CompletionStage<WSResponse> post(java.lang.String body)
body
- represented as Stringjava.util.concurrent.CompletionStage<WSResponse> post(com.fasterxml.jackson.databind.JsonNode body)
body
- represented as JSONjava.util.concurrent.CompletionStage<WSResponse> post(org.w3c.dom.Document body)
body
- represented as a Document@Deprecated java.util.concurrent.CompletionStage<WSResponse> post(java.io.InputStream body)
post(BodyWritable)
body
- represented as an InputStreamjava.util.concurrent.CompletionStage<WSResponse> post(java.io.File body)
body
- represented as a Filejava.util.concurrent.CompletionStage<WSResponse> post(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
body
- represented as a MultipartFormData.Partjava.util.concurrent.CompletionStage<WSResponse> put(play.libs.ws.BodyWritable body)
put
in interface play.libs.ws.StandaloneWSRequest
body
- represented as BodyWritablejava.util.concurrent.CompletionStage<WSResponse> put(java.lang.String body)
body
- represented as Stringjava.util.concurrent.CompletionStage<WSResponse> put(com.fasterxml.jackson.databind.JsonNode body)
body
- represented as JSONjava.util.concurrent.CompletionStage<WSResponse> put(org.w3c.dom.Document body)
body
- represented as a Documentjava.util.concurrent.CompletionStage<WSResponse> put(java.io.InputStream body)
body
- represented as an InputStreamjava.util.concurrent.CompletionStage<WSResponse> put(java.io.File body)
body
- represented as a Filejava.util.concurrent.CompletionStage<WSResponse> put(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
body
- represented as a MultipartFormData.Partjava.util.concurrent.CompletionStage<WSResponse> delete()
delete
in interface play.libs.ws.StandaloneWSRequest
java.util.concurrent.CompletionStage<WSResponse> head()
head
in interface play.libs.ws.StandaloneWSRequest
java.util.concurrent.CompletionStage<WSResponse> options()
options
in interface play.libs.ws.StandaloneWSRequest
java.util.concurrent.CompletionStage<WSResponse> execute(java.lang.String method)
execute
in interface play.libs.ws.StandaloneWSRequest
method
- The method to executejava.util.concurrent.CompletionStage<WSResponse> execute()
execute
in interface play.libs.ws.StandaloneWSRequest
java.util.concurrent.CompletionStage<WSResponse> stream()
stream
in interface play.libs.ws.StandaloneWSRequest
WSRequest setMethod(java.lang.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(java.lang.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(java.io.InputStream body)
setBody(BodyWritable)
body
- DeprecatedWSRequest setBody(java.io.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(java.lang.String name, java.lang.String value)
addHeader
in interface play.libs.ws.StandaloneWSRequest
name
- the header namevalue
- the header value@Deprecated WSRequest setHeader(java.lang.String name, java.lang.String value)
addHeader(String, String)
name
- the header namevalue
- the header valueWSRequest setHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
setHeaders
in interface play.libs.ws.StandaloneWSRequest
headers
- the headersWSRequest setQueryString(java.lang.String query)
setQueryString
in interface play.libs.ws.StandaloneWSRequest
query
- the fully formed query stringWSRequest setQueryString(java.util.Map<java.lang.String,java.util.List<java.lang.String>> params)
setQueryString
in interface play.libs.ws.StandaloneWSRequest
params
- the query string parametersWSRequest addQueryParameter(java.lang.String name, java.lang.String value)
addQueryParameter
in interface play.libs.ws.StandaloneWSRequest
name
- the query parameter namevalue
- the query parameter value@Deprecated WSRequest setQueryParameter(java.lang.String name, java.lang.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(java.util.List<play.libs.ws.WSCookie> cookies)
setCookies
in interface play.libs.ws.StandaloneWSRequest
cookies
- all the cookies.WSRequest setAuth(java.lang.String userInfo)
setAuth
in interface play.libs.ws.StandaloneWSRequest
userInfo
- a string formed as "username:password".WSRequest setAuth(java.lang.String username, java.lang.String password)
setAuth
in interface play.libs.ws.StandaloneWSRequest
username
- the basic auth usernamepassword
- the basic auth passwordWSRequest setAuth(java.lang.String username, java.lang.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(java.lang.String virtualHost)
setVirtualHost
in interface play.libs.ws.StandaloneWSRequest
virtualHost
- the virtual hostWSRequest setRequestTimeout(java.time.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(java.lang.String contentType)
setContentType
in interface play.libs.ws.StandaloneWSRequest
contentType
- The content typejava.lang.String getUrl()
getUrl
in interface play.libs.ws.StandaloneWSRequest
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
getHeaders
in interface play.libs.ws.StandaloneWSRequest
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getQueryParameters()
getQueryParameters
in interface play.libs.ws.StandaloneWSRequest