lundi 5 août 2019

Web.xml cannot route to location when error code 400

When i do security testing on my page. I put Invalid character to my get request url. It will pop up status 400 as usual. What my intended behavior is for my web.xml to route the error page to a specific html, but it doesn't work.

The current servlet is version 3.1 , I tried to use global handler and also specific handler in web.xml but both doesn't work for error code 400.

Disclaimer: code 404, 403, and 405 works.

<error-page>
    <error-code>400</error-code>
    <location>/WEB-INF/html/errors/badRequest.jsp</location>
</error-page>
<error-page>
    <error-code>404</error-code>
    <location>/WEB-INF/html/errors/fileNotFound.jsp</location>
</error-page>
<error-page>
    <error-code>403</error-code>
    <location>/WEB-INF/html/errors/accessDenied.json</location>
</error-page>
<error-page>
    <error-code>405</error-code>
    <location>/WEB-INF/html/errors/methodNotAllowed.json</location>
</error-page>
<error-page>
    <location>/WEB-INF/html/errors/badRequest.jsp</location>
</error-page>

Expected result is the error page be routed to badRequest.jsp




Aucun commentaire:

Enregistrer un commentaire