REST is a configuration-driven wrapper for the groovyx.net.http.HTTPBuilder.
Modifiers | Name | Description |
---|---|---|
java.lang.String |
userAgent |
Type | Name and description |
---|---|
static FWLog |
fwLog |
java.util.List<RequestHook> |
hooks List of hooks that should be called on a request before sending. |
Constructor and description |
---|
REST
(RESTConfig restConfig) Constructor |
Type Params | Return Type | Name and description |
---|---|---|
|
java.lang.Object |
doRequest(HTTPRequest rawRequest) Executes the request with an . |
|
groovyx.net.http.HTTPBuilder |
getHttpBuilder() This method returns an initialized groovyx.net.http.HTTPBuilder instance for the extended use cases. |
|
HTTPRequest |
newRequest(java.util.Map requestParams = [:]) Creates new request HTTPRequest request = restClient.newRequest([ method : 'GET', contentType : 'JSON', path : '/my/path/', query : [ parameter1 : 'value1' ], content : 'request body goes here', headers : [ 'Cookie' : 'shared-cookie;' ] ]) |
|
HTTPRequest |
prepareRequest(HTTPRequest rawRequest) Checking that the request has required values and is ready to be executed Additional actions (like OAuth processing) will be applied to the request |
|
java.lang.Object |
request(java.lang.String method, java.lang.String path, java.util.Map<java.lang.String, java.lang.String> queryParams = null, java.lang.String content = null) A handy shortcut for subsequent newRequest() and doRequest()) calls defaultContentType should be set first ( with setResponseContentType() ) |
|
void |
setResponseContentType(java.lang.String defaultContentType) Set new default content type to be set for the requests without a contentType set. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
List of hooks that should be called on a request before sending.
Constructor
Executes the request with an . Result will be parsed by the .
request
- HTTPRequest instance to be executedThis method returns an initialized groovyx.net.http.HTTPBuilder instance for the extended use cases.
Creates new request
HTTPRequest request = restClient.newRequest([ method : 'GET', contentType : 'JSON', path : '/my/path/', query : [ parameter1 : 'value1' ], content : 'request body goes here', headers : [ 'Cookie' : 'shared-cookie;' ] ])
Checking that the request has required values and is ready to be executed Additional actions (like OAuth processing) will be applied to the request
rawRequest
- an HTTPRequest instanceA handy shortcut for subsequent newRequest() and doRequest()) calls defaultContentType should be set first ( with setResponseContentType() )
Set new default content type to be set for the requests without a contentType set.
defaultContentType
- string that represents groovyx.net.http.ContentType objectGroovy Documentation