tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lar...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java
Date Tue, 12 Sep 2000 11:40:25 GMT
larryi      00/09/12 04:40:25

  Modified:    src/share/org/apache/tomcat/core Tag: tomcat_32
                        ContextManager.java
  Log:
  Removed extra semicolon causing handleError() to always use default handler.
  
  Submitted by: Joel Bartley (bartlejd@together.net)
  
  Also added missing lines to handleError() so JSP error pages work.
  
  Finally, added res.resetBuffer() call.  Since the default handling doesn't
  supply a complete HTML page, resetBuffer() is called only if non-default
  handling is used.  Modified handleStatus() to have the same behavior
  for the same reason.  If this isn't appropriate, someone please correct.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.100.2.7 +12 -4     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.6
  retrieving revision 1.100.2.7
  diff -u -r1.100.2.6 -r1.100.2.7
  --- ContextManager.java	2000/08/24 21:15:22	1.100.2.6
  +++ ContextManager.java	2000/09/12 11:40:24	1.100.2.7
  @@ -950,8 +950,6 @@
   	String errorPath=null;
   	Handler errorServlet=null;
   
  -	res.resetBuffer();
  -
   	if( code==0 )
   	    code=res.getStatus();
   	else
  @@ -983,6 +981,9 @@
   
   	if( errorServlet==null )
   	    errorServlet=ctx.getServletByName( "tomcat.statusHandler");
  +	else
  +	    // reset buffer only if using a non-default handler
  +	    res.resetBuffer();
   
   	req.setAttribute("javax.servlet.error.status_code",new Integer( code));
   
  @@ -1029,7 +1030,6 @@
   	    t.printStackTrace();
   	}
   
  -
   	String errorPath=null;
   	Handler errorServlet=null;
   
  @@ -1044,10 +1044,18 @@
   
   	if( errorPath != null ) {
   	    errorServlet=getHandlerForPath( ctx, errorPath );
  +
  +            // Make sure Jsps will work
  +	    req.setAttribute( "javax.servlet.include.request_uri",
  +				  ctx.getPath()  + "/" + errorPath );
  +	    req.setAttribute( "javax.servlet.include.servlet_path", errorPath );
   	}
   
  -	if( errorLoop( ctx, req ) || errorServlet==null) ;
  +	if( errorLoop( ctx, req ) || errorServlet==null)
   	    errorServlet = ctx.getServletByName("tomcat.exceptionHandler");
  +	else
  +	    // reset buffer only if using a non-default handler
  +	    res.resetBuffer();
   
   	req.setAttribute("javax.servlet.error.exception_type", t.getClass());
   	req.setAttribute("javax.servlet.error.message", t.getMessage());
  
  
  

Mime
View raw message