8.3.3 Redirects In URL Mappings

Since Grails 2.3, it is possible to define URL mappings which specify a redirect.When a URL mapping specifies a redirect, any time that mapping matches an incomingrequest, a redirect is initiated with information provided by the mapping.

When a URL mapping specifies a redirect the mapping must either supply a Stringrepresenting a URI to redirect to or must provide a Map representing the targetof the redirect. That Map is structured just like the Map that may be passedas an argument to the redirect method in a controller.

  1. "/viewBooks"(redirect: '/books/list')
  2. "/viewAuthors"(redirect: [controller: 'author', action: 'list'])
  3. "/viewPublishers"(redirect: [controller: 'publisher', action: 'list', permanent: true])

Request parameters that were part of the original request will be included in the redirect.