public class AhcWSRequest extends java.lang.Object implements WSRequest
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.String |
getContentType() |
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(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(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(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(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,
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.
|
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 |
setFollowRedirects(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)
Sets the HTTP method this request should use, where the no args execute() method is invoked.
|
WSRequest |
setMultipartBody(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
Set the multipart body this request should use.
|
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 |
setRequestFilter(WSRequestFilter filter)
Adds a request filter.
|
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<? extends StreamedResponse> |
stream()
Execute this request and stream the response body.
|
public WSRequest setMultipartBody(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
WSRequest
setMultipartBody
in interface WSRequest
body
- the body of the request.public java.util.concurrent.CompletionStage<WSResponse> get()
WSRequest
get
in interface StandaloneWSRequest
get
in interface WSRequest
public java.util.concurrent.CompletionStage<WSResponse> patch(java.lang.String body)
WSRequest
patch
in interface StandaloneWSRequest
patch
in interface WSRequest
body
- represented as Stringpublic java.util.concurrent.CompletionStage<WSResponse> patch(com.fasterxml.jackson.databind.JsonNode body)
WSRequest
patch
in interface StandaloneWSRequest
patch
in interface WSRequest
body
- represented as JSONpublic java.util.concurrent.CompletionStage<WSResponse> patch(java.io.InputStream body)
WSRequest
patch
in interface StandaloneWSRequest
patch
in interface WSRequest
body
- represented as an InputStreampublic java.util.concurrent.CompletionStage<WSResponse> patch(java.io.File body)
WSRequest
patch
in interface StandaloneWSRequest
patch
in interface WSRequest
body
- represented as a Filepublic java.util.concurrent.CompletionStage<WSResponse> post(java.lang.String body)
WSRequest
post
in interface StandaloneWSRequest
post
in interface WSRequest
body
- represented as Stringpublic java.util.concurrent.CompletionStage<WSResponse> post(com.fasterxml.jackson.databind.JsonNode body)
WSRequest
post
in interface StandaloneWSRequest
post
in interface WSRequest
body
- represented as JSONpublic java.util.concurrent.CompletionStage<WSResponse> post(java.io.InputStream body)
WSRequest
post
in interface StandaloneWSRequest
post
in interface WSRequest
body
- represented as an InputStreampublic java.util.concurrent.CompletionStage<WSResponse> post(java.io.File body)
WSRequest
post
in interface StandaloneWSRequest
post
in interface WSRequest
body
- represented as a Filepublic java.util.concurrent.CompletionStage<WSResponse> put(java.lang.String body)
WSRequest
put
in interface StandaloneWSRequest
put
in interface WSRequest
body
- represented as Stringpublic java.util.concurrent.CompletionStage<WSResponse> put(com.fasterxml.jackson.databind.JsonNode body)
WSRequest
put
in interface StandaloneWSRequest
put
in interface WSRequest
body
- represented as JSONpublic java.util.concurrent.CompletionStage<WSResponse> put(java.io.InputStream body)
WSRequest
put
in interface StandaloneWSRequest
put
in interface WSRequest
body
- represented as an InputStreampublic java.util.concurrent.CompletionStage<WSResponse> put(java.io.File body)
WSRequest
put
in interface StandaloneWSRequest
put
in interface WSRequest
body
- represented as a Filepublic java.util.concurrent.CompletionStage<WSResponse> delete()
WSRequest
delete
in interface StandaloneWSRequest
delete
in interface WSRequest
public java.util.concurrent.CompletionStage<WSResponse> head()
WSRequest
head
in interface StandaloneWSRequest
head
in interface WSRequest
public java.util.concurrent.CompletionStage<WSResponse> options()
WSRequest
options
in interface StandaloneWSRequest
options
in interface WSRequest
public java.util.concurrent.CompletionStage<WSResponse> execute(java.lang.String method)
WSRequest
execute
in interface StandaloneWSRequest
execute
in interface WSRequest
method
- The method to executepublic java.util.concurrent.CompletionStage<WSResponse> execute()
WSRequest
execute
in interface StandaloneWSRequest
execute
in interface WSRequest
public java.util.concurrent.CompletionStage<? extends StreamedResponse> stream()
WSRequest
stream
in interface StandaloneWSRequest
stream
in interface WSRequest
public WSRequest setMethod(java.lang.String method)
WSRequest
setMethod
in interface StandaloneWSRequest
setMethod
in interface WSRequest
method
- the HTTP method.public WSRequest setBody(java.lang.String body)
WSRequest
setBody
in interface StandaloneWSRequest
setBody
in interface WSRequest
body
- the body of the request.public WSRequest setBody(com.fasterxml.jackson.databind.JsonNode body)
WSRequest
setBody
in interface StandaloneWSRequest
setBody
in interface WSRequest
body
- the body of the request.@Deprecated public WSRequest setBody(java.io.InputStream body)
WSRequest
setBody
in interface StandaloneWSRequest
setBody
in interface WSRequest
body
- Deprecatedpublic WSRequest setBody(java.io.File body)
WSRequest
setBody
in interface StandaloneWSRequest
setBody
in interface WSRequest
body
- the body of the request.public <U> WSRequest setBody(akka.stream.javadsl.Source<akka.util.ByteString,U> body)
WSRequest
setBody
in interface StandaloneWSRequest
setBody
in interface WSRequest
body
- the body of the request.public WSRequest setHeader(java.lang.String name, java.lang.String value)
WSRequest
setHeader
in interface StandaloneWSRequest
setHeader
in interface WSRequest
name
- the header namevalue
- the header valuepublic WSRequest setQueryString(java.lang.String query)
WSRequest
setQueryString
in interface StandaloneWSRequest
setQueryString
in interface WSRequest
query
- the fully formed query stringpublic WSRequest setQueryParameter(java.lang.String name, java.lang.String value)
WSRequest
setQueryParameter
in interface StandaloneWSRequest
setQueryParameter
in interface WSRequest
name
- the query parameter namevalue
- the query parameter valuepublic WSRequest setAuth(java.lang.String userInfo)
WSRequest
setAuth
in interface StandaloneWSRequest
setAuth
in interface WSRequest
userInfo
- a string formed as "username:password".public WSRequest setAuth(java.lang.String username, java.lang.String password)
WSRequest
setAuth
in interface StandaloneWSRequest
setAuth
in interface WSRequest
username
- the basic auth usernamepassword
- the basic auth passwordpublic WSRequest setAuth(java.lang.String username, java.lang.String password, WSAuthScheme scheme)
WSRequest
setAuth
in interface StandaloneWSRequest
setAuth
in interface WSRequest
username
- the usernamepassword
- the passwordscheme
- authentication schemepublic WSRequest sign(WSSignatureCalculator calculator)
WSRequest
sign
in interface StandaloneWSRequest
sign
in interface WSRequest
calculator
- the signature calculatorpublic WSRequest setFollowRedirects(boolean followRedirects)
WSRequest
setFollowRedirects
in interface StandaloneWSRequest
setFollowRedirects
in interface WSRequest
followRedirects
- true if the request should follow redirectspublic WSRequest setVirtualHost(java.lang.String virtualHost)
WSRequest
setVirtualHost
in interface StandaloneWSRequest
setVirtualHost
in interface WSRequest
virtualHost
- the virtual hostpublic WSRequest setRequestTimeout(long timeout)
WSRequest
setRequestTimeout
in interface StandaloneWSRequest
setRequestTimeout
in interface WSRequest
timeout
- the request timeout in milliseconds. A value of -1 indicates an infinite request timeout.public WSRequest setRequestFilter(WSRequestFilter filter)
WSRequest
setRequestFilter
in interface StandaloneWSRequest
setRequestFilter
in interface WSRequest
filter
- a transforming filter.public WSRequest setContentType(java.lang.String contentType)
WSRequest
setContentType
in interface StandaloneWSRequest
setContentType
in interface WSRequest
contentType
- The content typepublic java.lang.String getUrl()
getUrl
in interface StandaloneWSRequest
public java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> getHeaders()
getHeaders
in interface StandaloneWSRequest
public java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> getQueryParameters()
getQueryParameters
in interface StandaloneWSRequest
public java.lang.String getUsername()
getUsername
in interface StandaloneWSRequest
public java.lang.String getPassword()
getPassword
in interface StandaloneWSRequest
public WSAuthScheme getScheme()
getScheme
in interface StandaloneWSRequest
public WSSignatureCalculator getCalculator()
getCalculator
in interface StandaloneWSRequest
public long getRequestTimeout()
StandaloneWSRequest
getRequestTimeout
in interface StandaloneWSRequest
public boolean getFollowRedirects()
getFollowRedirects
in interface StandaloneWSRequest
public java.lang.String getContentType()
getContentType
in interface StandaloneWSRequest
public java.util.concurrent.CompletionStage<WSResponse> patch(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
WSRequest
public java.util.concurrent.CompletionStage<WSResponse> post(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
WSRequest
public java.util.concurrent.CompletionStage<WSResponse> put(akka.stream.javadsl.Source<? super Http.MultipartFormData.Part<akka.stream.javadsl.Source<akka.util.ByteString,?>>,?> body)
WSRequest