diff --git a/src/en/guide/theWebLayer/urlmappings/mappingToResponseCodes.adoc b/src/en/guide/theWebLayer/urlmappings/mappingToResponseCodes.adoc index 9c0da9d72c0..69773c3e983 100644 --- a/src/en/guide/theWebLayer/urlmappings/mappingToResponseCodes.adoc +++ b/src/en/guide/theWebLayer/urlmappings/mappingToResponseCodes.adoc @@ -1,4 +1,4 @@ -Grails also lets you map HTTP response codes to controllers, actions or views. Just use a method name that matches the response code you are interested in: +Grails also lets you map HTTP response codes to controllers, actions, views or URIs. Just use a method name that matches the response code you are interested in: [source,groovy] ---- @@ -20,6 +20,17 @@ static mappings = { } ---- +You can also specify custom URIs: + +[source,groovy] +---- +static mappings = { + "403"(uri: "/errors/forbidden") + "404"(uri: "/errors/notFound") + "500"(uri: "/errors/serverError") +} +---- + ==== Declarative Error Handling