public abstract static class WS.WSRequest extends Object
Modifier and Type | Field and Description |
---|---|
Object |
body
The body of this request
|
String |
encoding |
WS.FileParam[] |
fileParams |
boolean |
followRedirects
Sets whether redirects (301, 302) should be followed automatically
|
Map<String,String> |
headers |
String |
mimeType |
OAuth.ServiceInfo |
oauthInfo |
String |
oauthSecret |
String |
oauthToken |
Map<String,Object> |
parameters |
String |
password |
WS.Scheme |
scheme |
Integer |
timeout
timeout: value in seconds
|
String |
url |
String |
username |
String |
virtualHost
The virtual host this request will use
|
Constructor and Description |
---|
WSRequest() |
WSRequest(String url,
String encoding) |
Modifier and Type | Method and Description |
---|---|
WS.WSRequest |
authenticate(String username,
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(String username,
String password,
WS.Scheme scheme)
define client authentication for a server host provided credentials
will be used during the request
|
protected String |
basicAuthHeader() |
WS.WSRequest |
body(Object body)
Add the given body to the request.
|
protected String |
createQueryString() |
abstract WS.HttpResponse |
delete()
Execute a DELETE request.
|
F.Promise<WS.HttpResponse> |
deleteAsync()
Execute a DELETE request asynchronously.
|
protected String |
encode(String part) |
WS.WSRequest |
files(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(Map<String,String> headers)
Use the provided headers when executing request.
|
WS.WSRequest |
mimeType(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,
String token,
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(Map<String,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(String name,
String value)
Add a header to the request
|
WS.WSRequest |
setParameter(String name,
Object value) |
WS.WSRequest |
setParameter(String name,
String value)
Add a parameter to the request
|
WS.WSRequest |
setParameters(Map<String,String> parameters)
Add parameters to request.
|
WS.WSRequest |
timeout(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(String virtualHost)
Sets the virtual host to use in this request
|
public String url
public String virtualHost
public final String encoding
public String username
public String password
public WS.Scheme scheme
public Object body
public WS.FileParam[] fileParams
public String mimeType
public boolean followRedirects
public Integer timeout
public OAuth.ServiceInfo oauthInfo
public String oauthToken
public String oauthSecret
public WS.WSRequest withVirtualHost(String virtualHost)
public WS.WSRequest mimeType(String mimeType)
mimeType
- public WS.WSRequest authenticate(String username, String password, WS.Scheme scheme)
username
- password
- public WS.WSRequest authenticate(String username, String password)
username
- password
- public WS.WSRequest oauth(OAuth.ServiceInfo oauthInfo, String token, String secret)
@Deprecated public WS.WSRequest oauth(OAuth.ServiceInfo oauthInfo, OAuth.TokenPair oauthTokens)
public WS.WSRequest followRedirects(boolean value)
public WS.WSRequest timeout(String timeout)
timeout
- the timeout value, e.g. "30s", "1min"public WS.WSRequest files(File... files)
files
- public WS.WSRequest files(WS.FileParam... fileParams)
fileParams
- public WS.WSRequest body(Object body)
body
- public WS.WSRequest setHeader(String name, String value)
name
- header namevalue
- header valuepublic WS.WSRequest setParameter(String name, String value)
name
- parameter namevalue
- parameter valuepublic WS.WSRequest setParameter(String name, Object value)
public WS.WSRequest headers(Map<String,String> headers)
headers
- public WS.WSRequest params(Map<String,Object> parameters)
public WS.WSRequest setParameters(Map<String,String> parameters)
public 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 String basicAuthHeader()
protected String createQueryString()
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly