public interface WSRequest
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 |
---|---|
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.
|
WSSignatureCalculator |
getCalculator() |
java.lang.Boolean |
getFollowRedirects() |
java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> |
getHeaders() |
java.lang.String |
getPassword() |
java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> |
getQueryParameters() |
long |
getRequestTimeout()
Gets the original request timeout in milliseconds, passed into the
request as input.
|
WSAuthScheme |
getScheme() |
java.lang.String |
getUrl() |
java.lang.String |
getUsername() |
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(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(java.lang.String body)
Perform a PATCH 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)
Perform a POST on the request asynchronously.
|
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(java.lang.String body)
Perform a POST 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(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,
WSAuthScheme scheme)
Sets the authentication header for the current request.
|
WSRequest |
setBody(java.io.File body)
Set the body this request should use.
|
WSRequest |
setBody(java.io.InputStream body)
Deprecated.
use
setBody(Source) instead. |
WSRequest |
setBody(com.fasterxml.jackson.databind.JsonNode body)
Set the body this request should use.
|
WSRequest |
setBody(akka.stream.javadsl.Source<akka.util.ByteString,?> 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 |
setFollowRedirects(java.lang.Boolean followRedirects)
Sets whether redirects (301, 302) should be followed automatically.
|
WSRequest |
setHeader(java.lang.String name,
java.lang.String value)
Adds a header to the request.
|
WSRequest |
setMethod(java.lang.String method)
Set 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)
Sets a query parameter with the given name, this can be called repeatedly.
|
WSRequest |
setQueryString(java.lang.String query)
Sets the query string to query.
|
WSRequest |
setRequestTimeout(long timeout)
Sets the request timeout in milliseconds.
|
WSRequest |
setVirtualHost(java.lang.String virtualHost)
Sets the virtual host as a "hostname:port" string.
|
WSRequest |
sign(WSSignatureCalculator calculator)
Sets an (OAuth) signature calculator.
|
java.util.concurrent.CompletionStage<StreamedResponse> |
stream()
Execute this request and stream the response body.
|
WSRequest |
withRequestFilter(WSRequestFilter filter)
Adds a request filter.
|
java.util.concurrent.CompletionStage<WSResponse> get()
java.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(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> 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(java.io.InputStream body)
body
- represented as an InputStreamjava.util.concurrent.CompletionStage<WSResponse> post(java.io.File body)
body
- represented as a Filejava.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(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> delete()
java.util.concurrent.CompletionStage<WSResponse> head()
java.util.concurrent.CompletionStage<WSResponse> options()
java.util.concurrent.CompletionStage<WSResponse> execute(java.lang.String method)
method
- The method to executejava.util.concurrent.CompletionStage<WSResponse> execute()
java.util.concurrent.CompletionStage<StreamedResponse> stream()
WSRequest withRequestFilter(WSRequestFilter filter)
filter
- a tranforming filter.WSRequest setMethod(java.lang.String method)
WSRequest setBody(java.lang.String body)
WSRequest setBody(com.fasterxml.jackson.databind.JsonNode body)
@Deprecated WSRequest setBody(java.io.InputStream body)
setBody(Source)
instead.body
- DeprecatedWSRequest setBody(java.io.File body)
WSRequest setBody(akka.stream.javadsl.Source<akka.util.ByteString,?> body)
WSRequest setHeader(java.lang.String name, java.lang.String value)
name
- the header namevalue
- the header valueWSRequest setQueryString(java.lang.String query)
query
- the fully formed query stringWSRequest setQueryParameter(java.lang.String name, java.lang.String value)
name
- the query parameter namevalue
- the query parameter valueWSRequest setAuth(java.lang.String userInfo)
userInfo
- a string formed as "username:password".WSRequest setAuth(java.lang.String username, java.lang.String password)
username
- the basic auth usernamepassword
- the basic auth passwordWSRequest setAuth(java.lang.String username, java.lang.String password, WSAuthScheme scheme)
username
- the usernamepassword
- the passwordscheme
- authentication schemeWSRequest sign(WSSignatureCalculator calculator)
calculator
- the signature calculatorWSRequest setFollowRedirects(java.lang.Boolean followRedirects)
followRedirects
- true if the request should follow redirectsWSRequest setVirtualHost(java.lang.String virtualHost)
virtualHost
- the virtual hostWSRequest setRequestTimeout(long timeout)
timeout
- the request timeout in milliseconds. A value of -1 indicates an infinite request timeout.WSRequest setContentType(java.lang.String contentType)
contentType
- The content typejava.lang.String getUrl()
java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> getHeaders()
java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> getQueryParameters()
java.lang.String getUsername()
java.lang.String getPassword()
WSAuthScheme getScheme()
WSSignatureCalculator getCalculator()
long getRequestTimeout()
java.lang.Boolean getFollowRedirects()