public abstract static class WS.WSRequest
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.Object |
body
The body of this request
|
java.lang.String |
encoding |
WS.FileParam[] |
fileParams |
boolean |
followRedirects
Sets whether redirects (301, 302) should be followed automatically
|
java.util.Map<java.lang.String,java.lang.String> |
headers |
java.lang.String |
mimeType |
OAuth.ServiceInfo |
oauthInfo |
java.lang.String |
oauthSecret |
java.lang.String |
oauthToken |
java.util.Map<java.lang.String,java.lang.Object> |
parameters |
java.lang.String |
password |
WS.Scheme |
scheme |
java.lang.Integer |
timeout
Timeout: value in seconds
|
java.lang.String |
url |
java.lang.String |
username |
java.lang.String |
virtualHost
The virtual host this request will use
|
Constructor and Description |
---|
WSRequest() |
WSRequest(java.lang.String url,
java.lang.String encoding) |
Modifier and Type | Method and Description |
---|---|
WS.WSRequest |
authenticate(java.lang.String username,
java.lang.String password)
define client authentication for a server host provided credentials will be used during the request the basic
scheme will be used
|
WS.WSRequest |
authenticate(java.lang.String username,
java.lang.String password,
WS.Scheme scheme)
Define client authentication for a server host provided credentials will be used during the request
|
protected java.lang.String |
basicAuthHeader() |
WS.WSRequest |
body(java.lang.Object body)
Add the given body to the request.
|
protected java.lang.String |
createQueryString() |
abstract WS.HttpResponse |
delete()
Execute a DELETE request.
|
F.Promise<WS.HttpResponse> |
deleteAsync()
Execute a DELETE request asynchronously.
|
protected java.lang.String |
encode(java.lang.String part) |
WS.WSRequest |
files(java.io.File... files)
Add files to request.
|
WS.WSRequest |
files(WS.FileParam... fileParams)
Add fileParams aka File and Name parameter to the request.
|
WS.WSRequest |
followRedirects(boolean value)
Indicate if the WS should continue when hitting a 301 or 302
|
abstract WS.HttpResponse |
get()
Execute a GET request synchronously.
|
F.Promise<WS.HttpResponse> |
getAsync()
Execute a GET request asynchronously.
|
abstract WS.HttpResponse |
head()
Execute a HEAD request.
|
F.Promise<WS.HttpResponse> |
headAsync()
Execute a HEAD request asynchronously.
|
WS.WSRequest |
headers(java.util.Map<java.lang.String,java.lang.String> headers)
Use the provided headers when executing request.
|
WS.WSRequest |
mimeType(java.lang.String mimeType)
Add a MimeType to the web service request.
|
WS.WSRequest |
oauth(OAuth.ServiceInfo oauthInfo,
OAuth.TokenPair oauthTokens)
Deprecated.
|
WS.WSRequest |
oauth(OAuth.ServiceInfo oauthInfo,
java.lang.String token,
java.lang.String secret)
Sign the request for do a call to a server protected by OAuth
|
abstract WS.HttpResponse |
options()
Execute a OPTIONS request.
|
F.Promise<WS.HttpResponse> |
optionsAsync()
Execute a OPTIONS request asynchronously.
|
WS.WSRequest |
params(java.util.Map<java.lang.String,java.lang.Object> parameters)
Add parameters to request.
|
abstract WS.HttpResponse |
patch()
Execute a PATCH request.
|
F.Promise<WS.HttpResponse> |
patchAsync()
Execute a PATCH request asynchronously.
|
abstract WS.HttpResponse |
post()
Execute a POST request.
|
F.Promise<WS.HttpResponse> |
postAsync()
Execute a POST request asynchronously.
|
abstract WS.HttpResponse |
put()
Execute a PUT request.
|
F.Promise<WS.HttpResponse> |
putAsync()
Execute a PUT request asynchronously.
|
WS.WSRequest |
setHeader(java.lang.String name,
java.lang.String value)
Add a header to the request
|
WS.WSRequest |
setParameter(java.lang.String name,
java.lang.Object value) |
WS.WSRequest |
setParameter(java.lang.String name,
java.lang.String value)
Add a parameter to the request
|
WS.WSRequest |
setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
Add parameters to request.
|
WS.WSRequest |
timeout(java.lang.String timeout)
Set the value of the request timeout, i.e. the number of seconds before cutting the connection - default to
60 seconds
|
abstract WS.HttpResponse |
trace()
Execute a TRACE request.
|
F.Promise<WS.HttpResponse> |
traceAsync()
Execute a TRACE request asynchronously.
|
WS.WSRequest |
withVirtualHost(java.lang.String virtualHost)
Sets the virtual host to use in this request
|
public java.lang.String url
public java.lang.String virtualHost
public final java.lang.String encoding
public java.lang.String username
public java.lang.String password
public WS.Scheme scheme
public java.lang.Object body
public WS.FileParam[] fileParams
public java.util.Map<java.lang.String,java.lang.String> headers
public java.util.Map<java.lang.String,java.lang.Object> parameters
public java.lang.String mimeType
public boolean followRedirects
public java.lang.Integer timeout
public OAuth.ServiceInfo oauthInfo
public java.lang.String oauthToken
public java.lang.String oauthSecret
public WSRequest()
public WSRequest(java.lang.String url, java.lang.String encoding)
public WS.WSRequest withVirtualHost(java.lang.String virtualHost)
virtualHost
- The given virtual hostpublic WS.WSRequest mimeType(java.lang.String mimeType)
mimeType
- the given mimeTypepublic WS.WSRequest authenticate(java.lang.String username, java.lang.String password, WS.Scheme scheme)
username
- Loginpassword
- Passwordscheme
- The given Schemepublic WS.WSRequest authenticate(java.lang.String username, java.lang.String password)
username
- Loginpassword
- Passwordpublic WS.WSRequest oauth(OAuth.ServiceInfo oauthInfo, java.lang.String token, java.lang.String secret)
oauthInfo
- OAuth Informationtoken
- The OAuth tokensecret
- The secret key@Deprecated public WS.WSRequest oauth(OAuth.ServiceInfo oauthInfo, OAuth.TokenPair oauthTokens)
public WS.WSRequest followRedirects(boolean value)
value
- Indicate if follow or not follow redirectspublic WS.WSRequest timeout(java.lang.String timeout)
timeout
- the timeout value, e.g. "30s", "1min"public WS.WSRequest files(java.io.File... files)
files
- list of filespublic WS.WSRequest files(WS.FileParam... fileParams)
fileParams
- The fileParams listpublic WS.WSRequest body(java.lang.Object body)
body
- The request bodypublic WS.WSRequest setHeader(java.lang.String name, java.lang.String value)
name
- header namevalue
- header valuepublic WS.WSRequest setParameter(java.lang.String name, java.lang.String value)
name
- parameter namevalue
- parameter valuepublic WS.WSRequest setParameter(java.lang.String name, java.lang.Object value)
public WS.WSRequest headers(java.util.Map<java.lang.String,java.lang.String> headers)
headers
- The request headerspublic WS.WSRequest params(java.util.Map<java.lang.String,java.lang.Object> parameters)
parameters
- The request parameterspublic WS.WSRequest setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
parameters
- The request parameterspublic abstract WS.HttpResponse get()
public F.Promise<WS.HttpResponse> getAsync()
public abstract WS.HttpResponse patch()
public F.Promise<WS.HttpResponse> patchAsync()
public abstract WS.HttpResponse post()
public F.Promise<WS.HttpResponse> postAsync()
public abstract WS.HttpResponse put()
public F.Promise<WS.HttpResponse> putAsync()
public abstract WS.HttpResponse delete()
public F.Promise<WS.HttpResponse> deleteAsync()
public abstract WS.HttpResponse options()
public F.Promise<WS.HttpResponse> optionsAsync()
public abstract WS.HttpResponse head()
public F.Promise<WS.HttpResponse> headAsync()
public abstract WS.HttpResponse trace()
public F.Promise<WS.HttpResponse> traceAsync()
protected java.lang.String basicAuthHeader()
protected java.lang.String encode(java.lang.String part)
protected java.lang.String createQueryString()
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly