Mantis - Resin
Viewing Issue Advanced Details
1316 minor always 08-26-06 17:28 05-29-07 14:47
iRideSnow  
ferg  
normal  
closed 3.0.21  
fixed  
none    
none 3.1.1  
0001316: <error-page> directive does not work in all cases.
This is similar to <http://bugs.caucho.com/view.php?id=1299>. [^]

If the location specified in the error-page directive is a "complex" jsp page, the result is that the contents of the error page are downloaded to the user's computer rather than processing/compiling/displaying the jsp in the user's browser.

A "complex" jsp, in this case, is one that has xml/xsl or possibly other includes that require some kind of pre-processing to occur.

The result of this bug is that web sites which use xml/xsl/etc types of templates/includes/whatever cannot have an error page which reflect changes made to global include files. The error page must be a simple jsp page which has to be updated by hand whenever a change is made to the global look/feel.

Rob

Notes
(0001491)
ferg   
08-01-06 16:03   
Can you give some more details? I'm not sure what's meant by complex jsp page.

Is it an issue with filters that might not be applied? That might make sense. Otherwise, an error-page is essentially a forward.
(0001492)
iRideSnow   
08-01-06 17:48   
I tried adding a note a bit ago, but it didn't work. Trying again.

As I mentioned in the original report, this is similar to bug 1299. Here's an example of what I'm calling a "complex" jsp page. If a page like this is used as the location for the error page, then the browser doesn't actually display the page, it downloads it as a file. This is the same behavior that the RewriteFilter servlet does when trying to redirect to a similar page. This is different from the rewrite-dispatch tag which IS able to redirect to this type of "complex" jsp page. It seems like if there is any kind of significant pre-processing that needs to be done, it doesn't get done, and the page is not successfully converted/compiled and is therefore treated like a regular text file by the browser.

Anyway, here's an example of a "complex" jsp page. Remember, this type of page is fine for the rewrite-dispatch directive. But it doesn't work with either the RewriteFilter or the <error-page>.

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" [^] [^] version="1.2">
    <!-- code layer, nothing that's outputting data -->
    <!-- include logic for xsl transformation filtering -->
    <jsp:directive.include file="/WEB-INF/jsp/transform.jsp"/>
    <jsp:scriptlet>
        request.setAttribute("caucho.xsl.stylesheet","/WEB-INF/xsl/secondary.xsl");
    </jsp:scriptlet>
    
    <!-- end code layer start xml output layer -->
    
    <page title="Page Not Found" menuId="" subMenuId="">
        <head>
            <meta name="description" content="404 Error Page" />
        </head>
        <jsp:directive.include file="/WEB-INF/xml/global_elements.xml"/>
        <jsp:directive.include file="/WEB-INF/xml/notFoundError.xml" />
        <rightSidebar>
            <jsp:directive.include file="/WEB-INF/xml/cta/startEdu.xml" />
            <jsp:directive.include file="/WEB-INF/xml/cta/questions.xml" />
        </rightSidebar>
    </page>
</jsp:root>
(0001966)
ferg   
05-29-07 14:47   
This is resolved with the ERROR filter type for Servlet 2.5, i.e. Resin 3.1.