Provides a simple client to resources exposed using Grails' REST support. Following the same conventions for URI scheme as Grails does
| Modifiers | Name | Description |
|---|---|---|
protected groovy.lang.Closure |
customizer |
|
protected java.lang.String |
templatedUrl |
| Type | Name and description |
|---|---|
RestBuilder |
restBuilder |
java.lang.String |
url |
| Constructor and description |
|---|
AbstractResourcesClient
(java.lang.String url)
|
AbstractResourcesClient
(java.lang.String url, RestBuilder restBuilder) |
| Type | Name and description |
|---|---|
protected java.lang.Object |
convertBody(java.lang.Object requestBody)Subclasses can optionally override to provide conversion |
void |
customize(groovy.lang.Closure customizer) |
RestResponse |
delete(java.lang.Object id)Issues a DELETE request for the given id |
T |
get(java.lang.String acceptContentType = getAcceptContentType()Issues a GET request to the configured URL |
T |
get(java.lang.Object id, java.lang.String acceptContentType = getAcceptContentType()Issues a GET request for the given id |
java.lang.String |
getAcceptContentType()@return Subclasses should implement to provide the default content type used to exchange resources |
java.lang.Class |
getAcceptType()Subclasses should implement to provide the conversion to the target representation (JSON, XML etc.) |
RestResponse |
head(java.lang.Object id)Issues a HEAD request for the given id |
RestResponse |
head()Issues a HEAD request for the given id |
RestResponse |
options(java.lang.Object id)Issues a OPTIONS request for the given id |
RestResponse |
options()Issues a OPTIONS request for the given id |
RestResponse |
patch(java.lang.Object id, java.lang.String requestBody, java.lang.String bodyContentType = getAcceptContentType()Issues a PATCH request for the given id |
RestResponse |
patch(java.lang.Object id, java.lang.Object requestBody, java.lang.String bodyContentType = getAcceptContentType()Issues a PATCH request for the given id |
RestResponse |
post(java.lang.Object requestBody, java.lang.String bodyContentType = getAcceptContentType()Issues a POST request for the given id |
RestResponse |
post(java.lang.String requestBody, java.lang.String bodyContentType = getAcceptContentType()Issues a POST request for the given id |
RestResponse |
put(java.lang.Object id, java.lang.String requestBody, java.lang.String bodyContentType = getAcceptContentType()Issues a PUT request for the given id |
RestResponse |
put(java.lang.Object id, java.lang.Object requestBody, java.lang.String bodyContentType = getAcceptContentType()Issues a PUT request for the given id |
| 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() |
url - The base URL. Example http://localhost:8080/booksSubclasses can optionally override to provide conversion
requestBody - The request bodyIssues a DELETE request for the given id
id - The idIssues a GET request to the configured URL
acceptContentType - The content type to pass in the ACCEPT headerIssues a GET request for the given id
id - The idacceptContentType - The content type to pass in the ACCEPT header
Subclasses should implement to provide the conversion to the target representation (JSON, XML etc.)
restResponse - The RestResponseIssues a HEAD request for the given id
id - The idIssues a HEAD request for the given id
id - The idIssues a OPTIONS request for the given id
id - The idIssues a OPTIONS request for the given id
id - The idIssues a PATCH request for the given id
requestBody - The requestBody of the requestIssues a PATCH request for the given id
requestBody - The requestBody of the requestIssues a POST request for the given id
requestBody - The requestBody of the requestIssues a POST request for the given id
requestBody - The requestBody of the requestIssues a PUT request for the given id
requestBody - The requestBody of the requestIssues a PUT request for the given id
requestBody - The requestBody of the request