Search code examples
grailsgrails-controller

grails respond error page with status from Url mapping file


Can I respond error pages with status code from url mapping file.

Basically I have a DemoController with Action Index. And I have created URL Mapping for "/" -> demo/index. So now index action of demo controller is accessible by two urls i.r. /demo/index and /.

Now I want that if anyone hit /demo/index should be respond a error page with status 404


Solution

  • What about simply excluding /demo/index from mapping like this:

    static excludes = ['/demo/index']