play.libs
Class WS.WSRequest

java.lang.Object
  extended by play.libs.WS.WSRequest
Enclosing class:
WS

public static class WS.WSRequest
extends Object


Field Summary
 String body
           
 WS.FileParam[] fileParams
           
 Map<String,String> headers
           
 String mimeType
           
 Map<String,Object> parameters
           
 Integer timeout
           
 String url
           
 
Method Summary
 WS.WSRequest body(String body)
          Add the given body to the request.
 WS.HttpResponse delete()
          Execute a DELETE request.
 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.HttpResponse get()
          Execute a GET request.
 WS.HttpResponse head()
          Execute a HEAD request.
 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.HttpResponse options()
          Execute a OPTIONS request.
 WS.WSRequest params(Map<String,Object> parameters)
          Add parameters to request.
 WS.HttpResponse post()
          Execute a POST request.
 WS.HttpResponse put()
          Execute a PUT request.
 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)
           
 WS.WSRequest timeout(int to)
           
 WS.WSRequest timeout(String duration)
           
 WS.HttpResponse trace()
          Execute a TRACE request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

public String url

body

public String body

fileParams

public WS.FileParam[] fileParams

headers

public Map<String,String> headers

parameters

public Map<String,Object> parameters

mimeType

public String mimeType

timeout

public Integer timeout
Method Detail

mimeType

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

Parameters:
mimeType -
Returns:
the WSRequest for chaining.

timeout

public WS.WSRequest timeout(int to)

timeout

public WS.WSRequest timeout(String duration)

files

public WS.WSRequest files(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(String body)
Add the given body to the request.

Parameters:
body -
Returns:
the WSRequest for chaining.

setHeader

public WS.WSRequest setHeader(String name,
                              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(String name,
                                 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(String name,
                                 Object value)

headers

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

Parameters:
headers -
Returns:
the WSRequest for chaining.

params

public WS.WSRequest params(Map<String,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(Map<String,String> parameters)

get

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


post

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


put

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


delete

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


options

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


head

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


trace

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



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