You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by hg...@apache.org on 2002/06/27 10:08:39 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/jasper CommandLineContext.java

hgomez      2002/06/27 01:08:39

  Modified:    src/share/org/apache/jasper CommandLineContext.java
  Log:
  Fix a problem when a jsp include another jsp with relative path
  Provided by : Thibault Frey <th...@libertysurf.fr>
  
  Revision  Changes    Path
  1.8       +10 -0     jakarta-tomcat/src/share/org/apache/jasper/CommandLineContext.java
  
  Index: CommandLineContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/CommandLineContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CommandLineContext.java	7 Jan 2001 19:24:12 -0000	1.7
  +++ CommandLineContext.java	27 Jun 2002 08:08:39 -0000	1.8
  @@ -372,6 +372,16 @@
           if (path.startsWith("/")) {
               path = path.substring(1);
           }
  +        // if path is relative, 
  +        // prepends the eventualy webapp relative path
  +        // of the currently processed jsp
  +        // -> included jsp uri's have not to be webapp relative
  +        if ( ( ! path.startsWith( File.separator ) ) && ( ! jspFile.endsWith( path ) ) ) {
  +        	int i = jspFile.lastIndexOf( File.separatorChar );
  +        	if ( i >= 0 ) 
  +        		path = jspFile.substring( 0, i + 1 ) + path;
  +        		
  +        }
           File f = new File(uriRoot, path.replace('/', File.separatorChar));
           return f.getAbsolutePath();
       }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>