Grails running on Jetty displays 404 error page without layout template

I have a Grails 2.0.1 application. I installed the following UrlMapping:

"/"(controller:"home") "500"(view:'/error/serverError') "404"(view:'/error/notFound') 

This is my notFound.gsp page:

 <%@ page contentType="text/html;charset=UTF-8" %> <html> <head> <meta name="layout" content="main"/> <title>404 Not Found</title> </head> <body> <h2>Page not found</h2> <p>Back to <a href="${createLink(uri:'/')}">homepage</a></p> </body> </html> 

During development (for Tomcat), the 404 error page correctly displays the main layout template. But when I deploy the production war under Jetty 7.6.2, and I look at a non-existent url, I get a 404 error page, but without a basic layout template.

So, it seems that Grails 2.0.1 does not work well with Jetty, and the application cannot display the template with a 404 error.

Can anyone guess why I am getting this problem? I could not find anything on the net.

thanks

+4
source share
2 answers

Have you tried this: http://www.javathinking.com/2007/12/404-with-grails/

Instead of going directly to gsp, you can redirect to the ErrorController, which in turn redirects to different error pages.

0
source

I manually wrapped the error page

It is not elegant, but it works.

http://grails.org/doc/latest/ref/Tags/applyLayout.html

0
source

Source: https://habr.com/ru/post/1400868/


All Articles