You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2001/07/06 20:40:08 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java

larryi      01/07/06 11:40:08

  Modified:    src/share/org/apache/tomcat/core Tag: tomcat_32
                        ContextManager.java
  Log:
  Fix recursive error handling if web.xml maps error code 404 to a non-existent
  JSP page. With this fix, no response will be sent if status handler is called
  recursively. You will need to examine the log output to see the error.
  
  If web.xml maps error code 404 to a non-existent html, use default "not found"
  handler instead of default "status" handler.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.100.2.24 +22 -2     jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.100.2.23
  retrieving revision 1.100.2.24
  diff -u -r1.100.2.23 -r1.100.2.24
  --- ContextManager.java	2001/04/25 16:50:12	1.100.2.23
  +++ ContextManager.java	2001/07/06 18:40:05	1.100.2.24
  @@ -1047,8 +1047,16 @@
   	if( debug>0 )
   	    ctx.log( "Handler " + errorServlet + " " + errorPath);
   
  -	if( errorServlet==null )
  -	    errorServlet=ctx.getServletByName( "tomcat.statusHandler");
  +        if ( statusLoop( ctx, req ) ){
  +            log( "Error loop for " + req + " error code " + code);
  +            return;
  +        }
  +        if( errorServlet==null ) {
  +            if( code == 404 )
  +                errorServlet=ctx.getServletByName( "tomcat.notFoundHandler");
  +            else
  +                errorServlet=ctx.getServletByName( "tomcat.statusHandler");
  +        }
   
   	req.setAttribute("javax.servlet.error.status_code",new Integer( code));
   
  @@ -1194,6 +1202,18 @@
   	    return true;
   	}
   	return false;
  +    }
  +
  +    /** Handle the case of status handler generating an error
  +     */
  +    private boolean statusLoop( Context ctx, Request req ) {
  +        if ( req.getAttribute("javax.servlet.error.status_code") != null ) {
  +            if( ctx.getDebug() > 0 )
  +                ctx.log( "Error: nested error inside status servlet " +
  +                        req.getAttribute("javax.servlet.error.status_code"));
  +            return true;
  +        }
  +        return false;
       }
   
   	 /**
  
  
  

Re: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java

Posted by Renato Weiner <re...@yahoo.com>.
 Hi Larry,
Please, ignore my last message. With this change, it fixed the problem. 
Thanks a lot !!
Renato.
 
  larryi@apache.org wrote: larryi 01/07/06 11:40:08

Modified: src/share/org/apache/tomcat/core Tag: tomcat_32
ContextManager.java
Log:
Fix recursive error handling if web.xml maps error code 404 to a non-existent
JSP page. With this fix, no response will be sent if status handler is called
recursively. You will need to examine the log output to see the error.

If web.xml maps error code 404 to a non-existent html, use default "not found"
handler instead of default "status" handler.

Revision Changes Path
No revision


No revision


1.100.2.24 +22 -2 jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java

Index: ContextManager.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
retrieving revision 1.100.2.23
retrieving revision 1.100.2.24
diff -u -r1.100.2.23 -r1.100.2.24
--- ContextManager.java 2001/04/25 16:50:12 1.100.2.23
+++ ContextManager.java 2001/07/06 18:40:05 1.100.2.24
@@ -1047,8 +1047,16 @@
if( debug>0 )
ctx.log( "Handler " + errorServlet + " " + errorPath);

- if( errorServlet==null )
- errorServlet=ctx.getServletByName( "tomcat.statusHandler");
+ if ( statusLoop( ctx, req ) ){
+ log( "Error loop for " + req + " error code " + code);
+ return;
+ }
+ if( errorServlet==null ) {
+ if( code == 404 )
+ errorServlet=ctx.getServletByName( "tomcat.notFoundHandler");
+ else
+ errorServlet=ctx.getServletByName( "tomcat.statusHandler");
+ }

req.setAttribute("javax.servlet.error.status_code",new Integer( code));

@@ -1194,6 +1202,18 @@
return true;
}
return false;
+ }
+
+ /** Handle the case of status handler generating an error
+ */
+ private boolean statusLoop( Context ctx, Request req ) {
+ if ( req.getAttribute("javax.servlet.error.status_code") != null ) {
+ if( ctx.getDebug() > 0 )
+ ctx.log( "Error: nested error inside status servlet " +
+ req.getAttribute("javax.servlet.error.status_code"));
+ return true;
+ }
+ return false;
}

/**





---------------------------------
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 a year!
http://personal.mail.yahoo.com/