2 Replies Latest reply on Aug 17, 2005 6:56 AM by espinosa_cz

    what url caused '404' ?

      I have redirected the 404-error to an JSP (in my WEB.XML).
      I want to find out whatvthe client asked for that caused the 404.

      How can I do that ?
      Either in a JSP or in a Servlet.

        • 1. Re: what url caused '404' ?
          mrgarageman

          error 404 means file not found. it indicates bad link or you mistyped URL or something similar.

          • 2. Re: what url caused '404' ?

            in your servlet use this code:

            codeObj = request.getAttribute("javax.servlet.error.status_code");
             // 404 - file not found, 404 - authorization error etc.
            messageObj = request.getAttribute("javax.servlet.error.message");
            typeObj = request.getAttribute("javax.servlet.error.exception_type");
            errorException = (Throwable) request.getAttribute("javax.servlet.error.exception");
            troubleURI = (String) request.getAttribute("javax.servlet.error.request_uri");


            For more info look here
            http://servlets.com/soapbox/servlet23.html

            This attributes are part of Servlet 2.3 API. It was really hard to find this information, hope it helps someone.