You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/04/23 03:21:59 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/generators ErrorHandler.java

costin      01/04/22 18:21:59

  Modified:    src/share/org/apache/tomcat/modules/generators
                        ErrorHandler.java
  Log:
  Fix for #939 - error in error handling, double "/". Thanks to Ingo Luetkebohle for
  finding and sending the patch.
  
  Submitted by:	ingo@blank.pages.de (Ingo Luetkebohle)
  
  Revision  Changes    Path
  1.10      +21 -5     jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/ErrorHandler.java
  
  Index: ErrorHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/ErrorHandler.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ErrorHandler.java	2001/03/19 21:09:06	1.9
  +++ ErrorHandler.java	2001/04/23 01:21:58	1.10
  @@ -172,9 +172,17 @@
   	if( errorPath != null ) {
   	    errorServlet=getHandlerForPath( cm, ctx, errorPath );
   
  +	    String cpath=ctx.getPath();
  +	    if( cpath="/")  cpath="";
  +	    
   	    // Make sure Jsps will work - needed if the error page is a jsp
  -	    req.setAttribute( "javax.servlet.include.request_uri",
  -				  ctx.getPath()  + "/" + errorPath );
  +	    if ( null!=errorPath && errorPath.startsWith("/") ) {
  +		req.setAttribute( "javax.servlet.include.request_uri",
  +				  cpath  + errorPath );
  +	    } else {
  +		req.setAttribute( "javax.servlet.include.request_uri",
  +				  cpath  + "/" + errorPath );
  +	    }
   	    req.setAttribute( "javax.servlet.include.servlet_path", errorPath );
   	}
   
  @@ -281,9 +289,17 @@
   	if( errorPath != null ) {
   	    errorServlet=getHandlerForPath( cm, ctx, errorPath );
   
  -	    // Make sure Jsps will work
  -	    req.setAttribute( "javax.servlet.include.request_uri",
  -				  ctx.getPath()  + "/" + errorPath );
  +	    String cpath=ctx.getPath();
  +	    if( cpath="/")  cpath="";
  +	    
  +	    // Make sure Jsps will work - needed if the error page is a jsp
  +	    if ( null!=errorPath && errorPath.startsWith("/") ) {
  +		req.setAttribute( "javax.servlet.include.request_uri",
  +				  cpath  + errorPath );
  +	    } else {
  +		req.setAttribute( "javax.servlet.include.request_uri",
  +				  cpath  + "/" + errorPath );
  +	    }
   	    req.setAttribute( "javax.servlet.include.servlet_path", errorPath );
   	}