[jboss-jira] [JBoss JIRA] (JBWEB-301) When custom error pages are used in web.xml wrong status codes are returned

Aaron Ogburn (JIRA) issues at jboss.org
Mon Aug 11 10:06:32 EDT 2014


     [ https://issues.jboss.org/browse/JBWEB-301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aaron Ogburn updated JBWEB-301:
-------------------------------



> When custom error pages are used in web.xml wrong status codes are returned
> ---------------------------------------------------------------------------
>
>                 Key: JBWEB-301
>                 URL: https://issues.jboss.org/browse/JBWEB-301
>             Project: JBoss Web
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: JBossWeb-7.2.1.GA
>         Environment: JBoss EAP 6.1.1
> Red Hat Linux 6.1
> CamelServlet 2.13.0
>            Reporter: Troy Longo
>            Assignee: Remy Maucherat
>
> I have the following code in my ServletFilter
> if(request instanceof HttpServletRequest)
>         {
>             isHttpRequest = true;
>         
>             if(!(((HttpServletRequest)request).getMethod().equals("POST")))
>             {
>                 ((HttpServletResponse)response).sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
>                 return;
>             }
>         }
> When I send a GET request, everything works fine and I am receive a response with a 405 status code. However when I send a PUT or DELETE, I receive a 403 and 501 status code respectively. I have debugged through my code and verified that I am hitting the same line above in my code. What I noticed is that this code was working nicely until I added some custom error pages into my web.xml. My web xml error page definitions are as follows. Removing these custom error pages from the web.xml cause the code to work as expected.
> <!--<error-page>
>             <error-code>500</error-code>
>             <location>/WEB-INF/500Error.html</location>
>     </error-page>
>     <error-page>
>             <error-code>404</error-code>
>             <location>/WEB-INF/404Error.html</location>
>     </error-page>
>     <error-page>
>             <error-code>413</error-code>
>             <location>/WEB-INF/413Error.html</location>
>     </error-page>
>     <error-page>
>             <error-code>405</error-code>
>             <location>/WEB-INF/405Error.html</location>
>     </error-page>-->



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list