Uploaded image for project: 'JBoss Web'
  1. JBoss Web
  2. JBWEB-301

When custom error pages are used in web.xml wrong status codes are returned

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: JBossWeb-7.2.1.GA
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      JBoss EAP 6.1.1
      Red Hat Linux 6.1
      CamelServlet 2.13.0

      Description

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

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                rmaucher Remy Maucherat
                Reporter:
                tclongo Troy Longo
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: