play.libs
Class WS.WSRequest

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

public 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
           
 java.util.Map<java.lang.String,java.lang.Object> parameters
           
 java.lang.Integer timeout
           
 java.lang.String url
           
 
Method Summary
 WS.WSRequest body(java.lang.String body)
          Add the given body to the request.
 WS.HttpResponse delete()
          Execute a DELETE request.
 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.HttpResponse get()
          Execute a GET request.
 WS.HttpResponse head()
          Execute a HEAD request.
 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.HttpResponse options()
          Execute a OPTIONS request.
 WS.WSRequest params(java.util.Map<java.lang.String,java.lang.Object> parameters)
          Add parameters to request.
 WS.HttpResponse post()
          Execute a POST request.
 WS.HttpResponse put()
          Execute a PUT request.
 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.String value)
          Add a parameter to the request
 WS.WSRequest timeout(int to)
           
 WS.WSRequest timeout(java.lang.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 java.lang.String url

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
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.

timeout

public WS.WSRequest timeout(int to)

timeout

public WS.WSRequest timeout(java.lang.String duration)

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.String 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.

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.

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