(Quick Reference)

6.4.5 Mapping to HTTP methods - Reference Documentation

Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith

Version: null

6.4.5 Mapping to HTTP methods

URL mappings can also be configured to map based on the HTTP method (GET, POST, PUT or DELETE). This is very useful for RESTful APIs and for restricting mappings based on HTTP method.

Los mapeos de URL tambien puede ser configurados para mapear basado en el metodo deh HTTP (GET, POST, PUT or DELETE). Esto es muy util para APIs de RESTful y para restringir mapeos basados en el metodo de HTTP.

As an example the following mappings provide a RESTful API URL mappings for the ProductController:

Como ejemplo los siguientes mapeos proveen una RESTful API para mapeos de URL para el ProductController:

static mappings = {
   "/product/$id"(controller:"product") {
       action = [GET:"show", PUT:"update", DELETE:"delete", POST:"save"]
   }
}