Base class that can be extended to get the basic CRUD operations needed for a RESTful API.
Constructor and description |
---|
RestfulController
(java.lang.Class<T> resource) |
RestfulController
(java.lang.Class<T> resource, boolean readOnly) |
Type | Name and description |
---|---|
protected java.lang.Integer |
countResources() Counts all of resources |
java.lang.Object |
create() Displays a form to create a new resource |
protected java.lang.Object |
createResource(java.util.Map params) Creates a new instance of the resource for the given parameters |
protected java.lang.Object |
createResource() Creates a new instance of the resource. |
java.lang.Object |
delete() Deletes a resource for the given id |
java.lang.Object |
edit() |
protected java.util.Map |
getParametersToBind() The parameters that can be bound to a domain instance. |
protected boolean |
handleReadOnly() handles the request for write methods (create, edit, update, save, delete) when controller is in read only mode |
java.lang.Object |
index(java.lang.Integer max) Lists all resources up to the given maximum |
protected java.util.List<T> |
listAllResources(java.util.Map params) List all of resource based on parameters |
protected void |
notFound() |
protected java.lang.Object |
queryForResource(java.io.Serializable id) Queries for a resource for the given id |
java.lang.Object |
save() Saves a resource |
java.lang.Object |
show() Shows a single resource |
java.lang.Object |
update() Updates a resource 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() |
Counts all of resources
Displays a form to create a new resource
Creates a new instance of the resource for the given parameters
params
- The parametersCreates a new instance of the resource. If the request contains a body the body will be parsed and used to initialize the new instance, otherwise request parameters will be used to initialized the new instance.
Deletes a resource for the given id
id
- The idThe parameters that can be bound to a domain instance. Defaults to all, subclasses should override and customize the behavior
handles the request for write methods (create, edit, update, save, delete) when controller is in read only mode
Lists all resources up to the given maximum
max
- The maximumList all of resource based on parameters
Queries for a resource for the given id
id
- The idSaves a resource
Shows a single resource
id
- The id of the resourceUpdates a resource for the given id
Groovy Documentation