on 2018 May 30 9:44 AM
Hi, I'm trying to set custom error page for 500 response. I've set it like this:
<error-page>
<error-code>500</error-code>
<location>/WEB-INF/views/desktop/pages/error/error.jsp</location>
</error-page>
But it's not working for using not supported request type, I'm still getting error page with stack trace with exception org.springframework.web.HttpRequestMethodNotSupportedException. I also tried to set exception-type to java.lang.Exception, but it's not working either. How can it be set to make it work? Thanks
Request clarification before answering.
It's not a 500 error but rather a 405 Method Not Allowed
Just add another <error-page> for 405 errors
e.g.
<error-page>
<error-code>405</error-code>
<location>/WEB-INF/common/pages/error/serverError.jsp</location>
</error-page>
You can test it with something like
curl -ik -XPUT https://powertools.local:9002/ | head -n 1
e.g.
$ curl -ik -XPUT https://powertools.local:9002/ | head -n 1
HTTP/1.1 405 Method Not Allowed
Just replace with your correct hostname or you'll get a 500 error because there's no matching url pattern
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.