Type | Name and description |
---|---|
static Object |
allowedMethods |
boolean |
readOnly |
Class<T> |
resource |
String |
resourceClassName |
String |
resourceName |
Constructor and description |
---|
RestfulController(Class<T> resource) |
RestfulController(Class<T> resource, boolean readOnly) |
Type Params | Return Type | Name and description |
---|---|---|
|
protected Integer |
countResources() Counts all of resources |
|
Object |
create() Displays a form to create a new resource |
|
protected T |
createResource(Map params) Creates a new instance of the resource for the given parameters |
|
protected T |
createResource() Creates a new instance of the resource. |
|
Object |
delete() Deletes a resource for the given id |
|
protected void |
deleteResource(T resource) Deletes a resource |
|
Object |
edit() |
|
protected String |
getClassMessageArg() |
|
protected Object |
getObjectToBind() The object 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 |
|
Object |
index(Integer max) Lists all resources up to the given maximum |
|
protected List<T> |
listAllResources(Map params) List all of resource based on parameters |
|
protected void |
notFound() |
|
Object |
patch() Updates a resource for the given id |
|
protected T |
queryForResource(Serializable id) Queries for a resource for the given id |
|
Object |
save() Saves a resource |
|
protected T |
saveResource(T resource) Saves a resource |
|
Object |
show() Shows a single resource |
|
Object |
update() Updates a resource for the given id |
|
protected T |
updateResource(T resource) Updates a resource |
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 idDeletes a resource
resource
- The resource to be deletedThe object that can be bound to a domain instance. Defaults to the request. Subclasses may override this method to return anything that is a valid second argument to the bindData method in a controller. This could be the request, a Map or a org.grails.databinding.DataBindingSource.
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
Updates a resource for the given id
Queries for a resource for the given id
id
- The idSaves a resource
Saves a resource
resource
- The resource to be savedShows a single resource
id
- The id of the resourceUpdates a resource for the given id
Updates a resource
resource
- The resource to be updated