-
Notifications
You must be signed in to change notification settings - Fork 34
Combine Thymeleaf error pages #1119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Currently ErrorPagesCustomizer - maps to different request - to respective methods in ErrorController. |
Thank you, Mukesh! It's indeed a good question!
Yes, ErrorPagesCustomizer maps errors to URLs and these URLs are served by ErrorController (all expect FORBIDDEN_PAGE).
As far I see we don't need a common exception handler, we might have many exception handling mechanisms but all of them should use a single view.
Yes, we need to modify both methods to return a In order to modify FORBIDDEN_PAGE, we need to change
|
Uh oh!
There was an error while loading. Please reload this page.
We have 3 error pages (
src/main/webapp/WEB-INF/views/error/{403,404,500}.html
) that nearly identical to each other:The difference are the following:
The task is to combine them into a single page and use condition to find out what eror message/code. Perhaps, we can utilize
th:switch
/th:case
.See also https://www.thymeleaf.org/doc/articles/springsecurity.html part 3 with an example of that approach. Keep in mind, that our approach will be similar by idea but not literally -- we won't pass error message from controller but will decided what message to show dependig on a reponse status.
The text was updated successfully, but these errors were encountered: