4

I am using Grails 2.4.4 and would like to define a generic UrlMapping for a range of HTTP-error-codes (like 450-499, 510-540).

I've found some related questions - even on SO - but the answers are either outdated or not working.

The container does not start once I use regular expressions on error-mappings.

For instance, this simple example will fail:

"$errorCode" {
     controller = "error"
     action = "general"
     constraints {
          errorCode(matches:/\d{3}/)
     }
}

Does anyone know how I may approach this?

Community
  • 1
  • 1
Christopher Will
  • 2,991
  • 3
  • 29
  • 46

1 Answers1

0

I tried doing same using Filters but we cannot redirect again after checking status code in httpResponse hence that also doesn't help.

As per grails-doc "Mapping to Response Codes"

http://grails.github.io/grails-doc/3.1.x/guide/single.html#urlmappings

we can only hard code them and redirect it to mentioned controller and action. So you need to mention all http codes and handle all of them separately.

Thanks.

Anshul
  • 687
  • 9
  • 18