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

Troy Longo (JIRA) issues at jboss.org
Thu Jul 24 18:13:29 EDT 2014


Troy Longo created JBWEB-301:
--------------------------------

             Summary: 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
            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