play.libs
Class WS.WSRequest

java.lang.Object
  extended by play.libs.WS.WSRequest
Direct Known Subclasses:
WSAsync.WSAsyncRequest, WSUrlFetch.WSUrlfetchRequest
Enclosing class:
WS

public abstract static class WS.WSRequest
extends java.lang.Object


Field Summary
 java.lang.String body
           
 WS.FileParam[] fileParams
           
 java.util.Map<java.lang.String,java.lang.String> headers
           
 java.lang.String mimeType
           
 OAuth.ServiceInfo oauthInfo
           
 OAuth.TokenPair oauthTokens
           
 java.util.Map<java.lang.String,java.lang.Object> parameters
           
 java.lang.String password
           
 java.lang.Integer timeout
           
 java.lang.String url
           
 java.lang.String username
           
 
Constructor Summary
WS.WSRequest()
           
WS.WSRequest(java.lang.String url)
           
 
Method Summary
 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
 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.
 java.util.concurrent.Future<WS.HttpResponse> deleteAsync()
          Execute a DELETE request asynchronously.
 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.
abstract  WS.HttpResponse get()
          Execute a GET request synchronously.
 java.util.concurrent.Future<WS.HttpResponse> getAsync()
          Execute a GET request asynchronously.
abstract  WS.HttpResponse head()
          Execute a HEAD request.
 java.util.concurrent.Future<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)
          Sign the request for do a call to a server protected by oauth
abstract  WS.HttpResponse options()
          Execute a OPTIONS request.
 java.util.concurrent.Future<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 post()
          Execute a POST request.
 java.util.concurrent.Future<WS.HttpResponse> postAsync()
          Execute a POST request asynchronously.
abstract  WS.HttpResponse put()
          Execute a PUT request.
 java.util.concurrent.Future<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.
abstract  WS.HttpResponse trace()
          Execute a TRACE request.
 java.util.concurrent.Future<WS.HttpResponse> traceAsync()
          Execute a TRACE request asynchronously.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

public java.lang.String url

username

public java.lang.String username

password

public java.lang.String password

body

public java.lang.String body

fileParams

public WS.FileParam[] fileParams

headers

public java.util.Map<java.lang.String,java.lang.String> headers

parameters

public java.util.Map<java.lang.String,java.lang.Object> parameters

mimeType

public java.lang.String mimeType

timeout

public java.lang.Integer timeout

oauthInfo

public OAuth.ServiceInfo oauthInfo

oauthTokens

public OAuth.TokenPair oauthTokens
Constructor Detail

WS.WSRequest

public WS.WSRequest()

WS.WSRequest

public WS.WSRequest(java.lang.String url)
Method Detail

mimeType

public WS.WSRequest mimeType(java.lang.String mimeType)
Add a MimeType to the web service request.

Parameters:
mimeType -
Returns:
the WSRequest for chaining.

authenticate

public 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

Parameters:
username -
password -

oauth

public WS.WSRequest oauth(OAuth.ServiceInfo oauthInfo,
                          OAuth.TokenPair oauthTokens)
Sign the request for do a call to a server protected by oauth

Returns:

files

public WS.WSRequest files(java.io.File... files)
Add files to request. This will only work with POST or PUT.

Parameters:
files -
Returns:
the WSRequest for chaining.

files

public WS.WSRequest files(WS.FileParam... fileParams)
Add fileParams aka File and Name parameter to the request. This will only work with POST or PUT.

Parameters:
fileParams -
Returns:
the WSRequest for chaining.

body

public WS.WSRequest body(java.lang.Object body)
Add the given body to the request.

Parameters:
body -
Returns:
the WSRequest for chaining.

setHeader

public WS.WSRequest setHeader(java.lang.String name,
                              java.lang.String value)
Add a header to the request

Parameters:
name - header name
value - header value
Returns:
the WSRequest for chaining.

setParameter

public WS.WSRequest setParameter(java.lang.String name,
                                 java.lang.String value)
Add a parameter to the request

Parameters:
name - parameter name
value - parameter value
Returns:
the WSRequest for chaining.

setParameter

public WS.WSRequest setParameter(java.lang.String name,
                                 java.lang.Object value)

headers

public WS.WSRequest headers(java.util.Map<java.lang.String,java.lang.String> headers)
Use the provided headers when executing request.

Parameters:
headers -
Returns:
the WSRequest for chaining.

params

public WS.WSRequest params(java.util.Map<java.lang.String,java.lang.Object> parameters)
Add parameters to request. If POST or PUT, parameters are passed in body using x-www-form-urlencoded if alone, or form-data if there is files too. For any other method, those params are appended to the queryString.

Returns:
the WSRequest for chaining.

setParameters

public WS.WSRequest setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
Add parameters to request. If POST or PUT, parameters are passed in body using x-www-form-urlencoded if alone, or form-data if there is files too. For any other method, those params are appended to the queryString.

Returns:
the WSRequest for chaining.

get

public abstract WS.HttpResponse get()
Execute a GET request synchronously.


getAsync

public java.util.concurrent.Future<WS.HttpResponse> getAsync()
Execute a GET request asynchronously.


post

public abstract WS.HttpResponse post()
Execute a POST request.


postAsync

public java.util.concurrent.Future<WS.HttpResponse> postAsync()
Execute a POST request asynchronously.


put

public abstract WS.HttpResponse put()
Execute a PUT request.


putAsync

public java.util.concurrent.Future<WS.HttpResponse> putAsync()
Execute a PUT request asynchronously.


delete

public abstract WS.HttpResponse delete()
Execute a DELETE request.


deleteAsync

public java.util.concurrent.Future<WS.HttpResponse> deleteAsync()
Execute a DELETE request asynchronously.


options

public abstract WS.HttpResponse options()
Execute a OPTIONS request.


optionsAsync

public java.util.concurrent.Future<WS.HttpResponse> optionsAsync()
Execute a OPTIONS request asynchronously.


head

public abstract WS.HttpResponse head()
Execute a HEAD request.


headAsync

public java.util.concurrent.Future<WS.HttpResponse> headAsync()
Execute a HEAD request asynchronously.


trace

public abstract WS.HttpResponse trace()
Execute a TRACE request.


traceAsync

public java.util.concurrent.Future<WS.HttpResponse> traceAsync()
Execute a TRACE request asynchronously.


createQueryString

protected java.lang.String createQueryString()


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly