You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/05/18 14:29:42 UTC

DO NOT REPLY [Bug 20018] New: - ErrorPage directive doesn't work for http error codes (400,500,..)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20018>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20018

ErrorPage directive doesn't work for http error codes (400,500,..)

           Summary: ErrorPage directive doesn't work for http error codes
                    (400,500,..)
           Product: Tomcat 5
           Version: 5.0.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: tfohrer@t-online.de


Problem:          
           
Adding error-page directive to web.xml have no affect to tomcat error          
reporting.          
            
TestCase:             
            
1. getting working copy of jakarta-tomcat-5.0.2 
3. go to webapps/ROOT/WEB-INF            
4. add following to web.xml            
            
     <error-page>            
      <error-code>404</error-code>            
      <location>/404.html</location>            
     </error-page>            
           
5. create a file webapps/ROOT/404.html with some content           
6. start tomcat           
7. access http://localhost:8080/NotExistingFile.html           
8. getting error report from ErrorReportValve, and not /404.html    
                
Breakdown:         
         
1. Getting tomcat to print debug stuff ( especially DefaultServlet/Jasper )         
2. Seeing in source code, that ErrorDispatcherValve calls  
RequestDispatcher.forward         
with location of error-page         
4. But see, that jasper/defaultservlet trying to getting origin location,not  
the location of error-page        
5. Looking in ApplicationDispatcher, see that uri is changed without affect         
for error-pages, because processRequest using unaltered request for errors       
        
   
Possibly broken, but working small ( WORKSFORME!) fix:     
      
Index: ApplicationDispatcher.java            
===================================================================            
RCS file:            
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v            
retrieving revision 1.16            
diff -u -r1.16 ApplicationDispatcher.java            
--- ApplicationDispatcher.java  17 Apr 2003 15:31:45 -0000      1.16            
+++ ApplicationDispatcher.java  18 May 2003 12:04:59 -0000            
@@ -449,7 +449,7 @@            
                 wrequest.setQueryParams(queryString);            
             }            
            
-            processRequest(request,response);            
+            processRequest(wrequest,response);            
             unwrapRequest();            
            
         }

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org