2015-03-16 21:52 GMT+03:00 Jacob Haverkost <jdh5...@gmail.com>:
> Version: 6.0.43
> OS: Win7 x64
>
> Currently, the CGIServlet does not appear to support using the 404
> error-page specified in the web.xml (ROOT). The error-pages work fine
>
> This appears to be due to the line, res.setStatus(404);, inside of doGet().
> According to the documentation for HttpServletResponse.setStatus(int), "If
> this method is used to set an error code, then the container's error page
> mechanism will not be triggered."
>
> This line appears in all major versions of Tomcat that I have looked into
> (8.0.20, 7.0.59).
>
> Just for a quick test, I changed setStatus to sendError and the error-page
> worked as expected. Is there a way to have the error-page work without
> changing the source code? If not, should I submit a bug report to include a
> configuration parameter for the CGIServlet to allow support for the
> error-page?
>

If you are talking about the following: (lines 612-614 in CGIServlet
of current Tomcat 6.0.x)

        if (!cgiEnv.isValid()) {
            res.setStatus(404);
        }


You cannot just change res.setStatus(404);  with res.sendError(404),
as that will break the following code that generates a HTML page with
a debug message.

See the block starting with "if (debug >= 10)".


My guess (without looking deep into this) is that "if
(!cgiEnv.isValid())" condition is there to catch a configuration
error. I mean that you would not see that with a properly configured
CGIServlet.   If my guess is wrong, you need to provide a specific use
case that demonstrates otherwise.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to