tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/jasper/servlet JasperLoader.java JasperLoader12.java JspServlet.java ServletEngine.java TomcatServletEngine.java
Date Fri, 23 Jun 2000 21:37:40 GMT
costin      00/06/23 14:37:37

  Modified:    src/share/org/apache/jasper JspC.java
               src/share/org/apache/jasper/runtime HttpJspBase.java
                        JspLoader.java
  Added:       src/share/org/apache/jasper/servlet JasperLoader.java
                        JasperLoader12.java JspServlet.java
                        ServletEngine.java TomcatServletEngine.java
  Removed:     src/share/org/apache/jasper/runtime JspLoader12.java
                        JspServlet.java ServletEngine.java
                        TomcatServletEngine.java
  Log:
  Moved JspServlet and related classes in a separate package.
  Made JspLoader an abstract class, that would allow us to plug other
  implementations.
  
  Both changes are mostly "cosmetic" - there is no functionality change, just
  some files in a different package. The great benefit is that it clearly
  demarcate various components of jasper, and allows us to plug in specialized
  and optimized version of JspServlet.
  
  Jasper will still be available as a (more or less) portable servlet.
  
  This also reduces the number of required classes for a runtime ( i.e. if you
  use JspC for deployment ).
  
  Revision  Changes    Path
  1.14      +4 -4      jakarta-tomcat/src/share/org/apache/jasper/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- JspC.java	2000/06/15 00:26:42	1.13
  +++ JspC.java	2000/06/23 21:37:16	1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v 1.13 2000/06/15 00:26:42 costin Exp $
  - * $Revision: 1.13 $
  - * $Date: 2000/06/15 00:26:42 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v 1.14 2000/06/23 21:37:16 costin Exp $
  + * $Revision: 1.14 $
  + * $Date: 2000/06/23 21:37:16 $
    *
    * ====================================================================
    * 
  @@ -321,7 +321,7 @@
       {
           try {
               JspLoader loader =
  -                    new JspLoader();
  +                    new org.apache.jasper.servlet.JasperLoader();
   	    loader.setParentClassLoader(getClass().getClassLoader());
   	    loader.setOptions( this);
               CommandLineContext clctxt = new CommandLineContext(
  
  
  
  1.4       +1 -3      jakarta-tomcat/src/share/org/apache/jasper/runtime/HttpJspBase.java
  
  Index: HttpJspBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/HttpJspBase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpJspBase.java	1999/11/13 00:32:52	1.3
  +++ HttpJspBase.java	2000/06/23 21:37:24	1.4
  @@ -69,8 +69,6 @@
   import org.apache.jasper.JasperException;
   import org.apache.jasper.Constants;
   
  -import org.apache.jasper.compiler.TagLibraries;
  -
   /**
    * This is the subclass of all JSP-generated servlets.
    *
  @@ -107,7 +105,7 @@
   	jspDestroy();
       }
   
  -    final void setClassLoader(ClassLoader cl) {
  +    public final void setClassLoader(ClassLoader cl) {
           this.cl = cl;
       }
       
  
  
  
  1.12      +15 -237   jakarta-tomcat/src/share/org/apache/jasper/runtime/JspLoader.java
  
  Index: JspLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspLoader.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JspLoader.java	2000/06/15 18:50:06	1.11
  +++ JspLoader.java	2000/06/23 21:37:25	1.12
  @@ -1,8 +1,4 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspLoader.java,v 1.11 2000/06/15 18:50:06 costin Exp $
  - * $Revision: 1.11 $
  - * $Date: 2000/06/15 18:50:06 $
  - *
    * ====================================================================
    * 
    * The Apache Software License, Version 1.1
  @@ -78,39 +74,32 @@
   
   import org.apache.jasper.JasperException;
   import org.apache.jasper.Constants;
  -import org.apache.jasper.JspCompilationContext;
  -import org.apache.jasper.JspEngineContext;
   import org.apache.jasper.Options;
  -import org.apache.jasper.compiler.Compiler;
   
   import org.apache.tomcat.logging.Logger;
   import javax.servlet.http.*;
   /**
  - * This is a class loader that loads JSP files as though they were
  - * Java classes. It calls the compiler to compile the JSP file into a
  - * servlet and then loads the generated class. 
  - *
  - * This code is quite fragile and needs careful
  - * treatment/handling/revisiting. I know this doesn't work very well
  - * right now for:  
  - * 
  - * 	(a) inner classes
  - *	(b) does not work at all for tag handlers that have inner
  - *          classes; but that is likely to change with the new JSP PR2
  - *          spec. 
  + * Jsp compiler and runtime depends on special features from the
  + * ClassLoader.
  + *
  + *  It has to allow run-time addition of class paths and provide
  + *  access to the class path.
    *
  + *  The loader is also responsible for detecting changes and reloading.
  + *
    * @author Anil K. Vijendran
    * @author Harish Prabandham
  + * @author Costin Manolache
    */
   public class JspLoader extends ClassLoader {
  -    ClassLoader parent;
  -    Options options;
  -    Object pd;
  +    protected ClassLoader parent;
  +    protected Options options;
  +    //    Object pd;
   
       /*
        * This should be factoried out
        */
  -    public JspLoader() {
  +    protected JspLoader() {
   	super();
       }
   
  @@ -118,212 +107,14 @@
       {
   	this.parent = cl;
       }
  -    
  +
  +    // The only thing we use is getScratchDir !
       public void setOptions( Options options) {
   	this.options = options;
       }
   
  -    public void setProtectionDomain( Object pd ) {
  -	this.pd=pd;
  -    }
  -    
  -    protected synchronized Class loadClass(String name, boolean resolve)
  -	throws ClassNotFoundException
  -    {
  -	if( debug>0) log("load " + name );
  -	// First, check if the class has already been loaded
  -	Class c = findLoadedClass(name);
  -	if (c == null) {
  -	    try {
  -		if (parent != null) {
  -		    if(debug>0) log("load from parent " + name );
  -		    c = parent.loadClass(name);
  -                }
  -		else {
  -		    if(debug>0) log("load from system " + name );
  -		    c = findSystemClass(name);
  -                }
  -	    } catch (ClassNotFoundException e) {
  -		// If still not found, then call findClass in order
  -		// to find the class.
  -		try {
  -		    if(debug>0) log("local jsp loading " + name );
  -		    c = findClass(name);
  -		} catch (ClassNotFoundException ex) {
  -		    throw ex;
  -		}
  -	    }
  -	}
  -	if (resolve) {
  -	    resolveClass(c);
  -	}
  -	return c;
  -    }
  -    public InputStream getResourceAsStream(String name) {
  -	if( debug>0) log("getResourcesAsStream()" + name );
  -	URL url = getResource(name);
  -	try {
  -	    return url != null ? url.openStream() : null;
  -	} catch (IOException e) {
  -	    return null;
  -	}
  -    }
  +    protected Vector jars = new Vector();
       
  -    public URL getResource(String name) {
  -	if( debug>0) log( "getResource() " + name );
  -	if( parent != null )
  -	    return parent.getResource(name);
  -	return super.getResource(name);
  -    }
  -
  -    private static final int debug=0;
  -    private void log( String s ) {
  -	System.out.println("JspLoader: " + s );
  -    }
  -    
  -    protected Class findClass(String className) throws ClassNotFoundException {
  -	try {
  -	    int beg = className.lastIndexOf(".") == -1 ? 0 :
  -		className.lastIndexOf(".")+1;
  -	    int end = className.lastIndexOf("_jsp_");
  -
  -	    if (end <= 0) {     
  -                // this is a class that the JSP file depends on 
  -                // (example: class in a tag library)
  -                byte[] classBytes = loadClassDataFromJar(className);
  -                if (classBytes == null)
  -                    throw new ClassNotFoundException(className);
  -                return defClass(className, classBytes);
  -	    } else {
  -                String fileName = null;
  -                String outputDir = options.getScratchDir().toString();
  -            
  -                if (className.indexOf('$', end) != -1) {
  -                    // this means we're loading an inner class
  -                    fileName = outputDir + File.separatorChar + 
  -                        className.replace('.', File.separatorChar) + ".class";
  -                } else {
  -                    fileName = className.substring(beg, end) + ".class";
  -                    fileName = outputDir + File.separatorChar + fileName;
  -                }
  -                byte [] classBytes = null;
  -                /**
  -                 * When using a SecurityManager and a JSP page itself triggers
  -                 * another JSP due to an errorPage or from a jsp:include,
  -                 * the loadClass must be performed with the Permissions of
  -                 * this class using doPriviledged because the parent JSP
  -                 * may not have sufficient Permissions.
  -                 */
  -		classBytes = loadClassDataFromFile(fileName);
  -                if( classBytes == null ) {
  -                    throw new ClassNotFoundException(Constants.getString(
  -                                             "jsp.error.unable.loadclass", 
  -                                              new Object[] {className})); 
  -                }
  -                return defClass(className, classBytes);
  -            }
  -	} catch (Exception ex) {
  -            throw new ClassNotFoundException(Constants.getString(
  -	    				     "jsp.error.unable.loadclass", 
  -					      new Object[] {className}));
  -	}
  -    }
  -
  -    /**
  -     * Just a short hand for defineClass now... I suspect we might need to
  -     * make this public at some point of time. 
  -     */
  -    protected  Class defClass(String className, byte[] classData) {
  -        return defineClass(className, classData, 0, classData.length);
  -    }
  -
  -    /**
  -     * Load JSP class data from file, method may be called from
  -     * within a doPriviledged if a SecurityManager is installed.
  -     */
  -    protected byte[] loadClassDataFromFile(String fileName) {
  -	return doLoadClassDataFromFile( fileName );
  -    }
  -
  -    /**
  -     * Load JSP class data from file, method may be called from
  -     * within a doPriviledged if a SecurityManager is installed.
  -     */
  -    protected byte[] doLoadClassDataFromFile(String fileName) {
  -        byte[] classBytes = null;
  -        try {
  -            FileInputStream fin = new FileInputStream(fileName);
  -            ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -            byte buf[] = new byte[1024];
  -            for(int i = 0; (i = fin.read(buf)) != -1; )
  -                baos.write(buf, 0, i);
  -            fin.close();
  -            baos.close();
  -            classBytes = baos.toByteArray();
  -        } catch(Exception ex) {
  -            return null;
  -        }
  -        return classBytes;
  -    }
  -
  -    private Vector jars = new Vector();
  -    
  -    private byte[] loadClassDataFromJar(String className) {
  -        String entryName = className.replace('.','/')+".class";
  -	InputStream classStream = null;
  -	//System.out.println("Loading " + className);
  -
  -        for(int i = 0; i < jars.size(); i++) {
  -            File thisFile = new File((String) jars.elementAt(i));
  -            try {
  -                //System.out.println(" - trying " + thisFile.getAbsolutePath());
  -                // check if it exists...
  -                if (!thisFile.exists()) {
  -                    continue; 
  -                };
  -                
  -                if (thisFile.isFile()) {
  -                    ZipFile zip = new ZipFile(thisFile);
  -                    ZipEntry entry = zip.getEntry(entryName);
  -                    if (entry != null) {
  -			classStream = zip.getInputStream(entry);
  -                        byte[] classData = getClassData(classStream);
  -			zip.close();
  -			return classData;
  -		    } else {
  -			zip.close();
  -		    }
  -                } else { // its a directory...
  -                    File classFile = 
  -                        new File(thisFile,
  -                                 entryName.replace('/', File.separatorChar));
  -                    if (classFile.exists()) {
  -                        classStream = new FileInputStream(classFile);
  -                        byte[] classData = getClassData(classStream);
  -                        classStream.close();
  -                        return classData;
  -                    }
  -                }
  -            } catch (IOException ioe) {
  -                return null;
  -            }
  -        }
  -        
  -        return null;
  -    }
  -
  -    private byte[] getClassData(InputStream istream) throws IOException {
  -	byte[] buf = new byte[1024];
  -	ByteArrayOutputStream bout = new ByteArrayOutputStream();
  -	int num = 0;
  -	while((num = istream.read(buf)) != -1) {
  -	    bout.write(buf, 0, num);
  -	}
  -
  -	return bout.toByteArray();
  -    }
  -
  -    
       public void addJar(String jarFileName) throws IOException {
           if (!jars.contains(jarFileName)) {
               Constants.message("jsp.message.adding_jar",
  @@ -344,17 +135,4 @@
           
           return cpath.toString();
       }
  -
  -    public String toString() {
  -	return "JspLoader( " +  options.getScratchDir()   + " ) / " + parent;
  -    }
  -
  -    boolean loadJSP(JspServlet jspS, String name, String classpath, 
  -		    boolean isErrorPage, HttpServletRequest req,
  -		    HttpServletResponse res) 
  -	throws JasperException, FileNotFoundException 
  -    {
  -	return jspS.doLoadJSP( name, classpath, isErrorPage, req, res );
  -    }
  -
   }
  
  
  
  1.1                  jakarta-tomcat/src/share/org/apache/jasper/servlet/JasperLoader.java
  
  Index: JasperLoader.java
  ===================================================================
  /*
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.jasper.servlet;
  
  import java.io.FileInputStream;
  import java.io.ByteArrayOutputStream;
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.InputStream;
  import java.io.IOException;
  
  import java.util.Hashtable;
  import java.util.Vector;
  import java.util.zip.ZipFile;
  import java.util.zip.ZipEntry;
  import java.net.URL;
  
  import java.security.*;
  
  import org.apache.jasper.JasperException;
  import org.apache.jasper.Constants;
  import org.apache.jasper.JspCompilationContext;
  import org.apache.jasper.JspEngineContext;
  import org.apache.jasper.Options;
  import org.apache.jasper.compiler.Compiler;
  
  import org.apache.tomcat.logging.Logger;
  import javax.servlet.http.*;
  /**
   * This is a class loader that loads JSP files as though they were
   * Java classes. It calls the compiler to compile the JSP file into a
   * servlet and then loads the generated class. 
   *
   * This code is quite fragile and needs careful
   * treatment/handling/revisiting. I know this doesn't work very well
   * right now for:  
   * 
   * 	(a) inner classes
   *	(b) does not work at all for tag handlers that have inner
   *          classes; but that is likely to change with the new JSP PR2
   *          spec. 
   *
   * @author Anil K. Vijendran
   * @author Harish Prabandham
   */
  public class JasperLoader extends org.apache.jasper.runtime.JspLoader {
  //     ClassLoader parent;
  //     Options options;
      Object pd;
  
      /*
       * This should be factoried out
       */
      public JasperLoader() {
  	super();
      }
  
  //     public void setParentClassLoader( ClassLoader cl) 
  //     {
  // 	this.parent = cl;
  //     }
      
  //     public void setOptions( Options options) {
  // 	this.options = options;
  //     }
  
      public void setProtectionDomain( Object pd ) {
  	this.pd=pd;
      }
      
      protected synchronized Class loadClass(String name, boolean resolve)
  	throws ClassNotFoundException
      {
  	if( debug>0) log("load " + name );
  	// First, check if the class has already been loaded
  	Class c = findLoadedClass(name);
  	if (c == null) {
  	    try {
  		if (parent != null) {
  		    if(debug>0) log("load from parent " + name );
  		    c = parent.loadClass(name);
                  }
  		else {
  		    if(debug>0) log("load from system " + name );
  		    c = findSystemClass(name);
                  }
  	    } catch (ClassNotFoundException e) {
  		// If still not found, then call findClass in order
  		// to find the class.
  		try {
  		    if(debug>0) log("local jsp loading " + name );
  		    c = findClass(name);
  		} catch (ClassNotFoundException ex) {
  		    throw ex;
  		}
  	    }
  	}
  	if (resolve) {
  	    resolveClass(c);
  	}
  	return c;
      }
      public InputStream getResourceAsStream(String name) {
  	if( debug>0) log("getResourcesAsStream()" + name );
  	URL url = getResource(name);
  	try {
  	    return url != null ? url.openStream() : null;
  	} catch (IOException e) {
  	    return null;
  	}
      }
      
      public URL getResource(String name) {
  	if( debug>0) log( "getResource() " + name );
  	if( parent != null )
  	    return parent.getResource(name);
  	return super.getResource(name);
      }
  
      private static final int debug=0;
  
      private void log( String s ) {
  	System.out.println("JspLoader: " + s );
      }
      
      protected Class findClass(String className) throws ClassNotFoundException {
  	try {
  	    int beg = className.lastIndexOf(".") == -1 ? 0 :
  		className.lastIndexOf(".")+1;
  	    int end = className.lastIndexOf("_jsp_");
  
  	    if (end <= 0) {     
                  // this is a class that the JSP file depends on 
                  // (example: class in a tag library)
                  byte[] classBytes = loadClassDataFromJar(className);
                  if (classBytes == null)
                      throw new ClassNotFoundException(className);
                  return defClass(className, classBytes);
  	    } else {
                  String fileName = null;
                  String outputDir = options.getScratchDir().toString();
              
                  if (className.indexOf('$', end) != -1) {
                      // this means we're loading an inner class
                      fileName = outputDir + File.separatorChar + 
                          className.replace('.', File.separatorChar) + ".class";
                  } else {
                      fileName = className.substring(beg, end) + ".class";
                      fileName = outputDir + File.separatorChar + fileName;
                  }
                  byte [] classBytes = null;
                  /**
                   * When using a SecurityManager and a JSP page itself triggers
                   * another JSP due to an errorPage or from a jsp:include,
                   * the loadClass must be performed with the Permissions of
                   * this class using doPriviledged because the parent JSP
                   * may not have sufficient Permissions.
                   */
  		classBytes = loadClassDataFromFile(fileName);
                  if( classBytes == null ) {
                      throw new ClassNotFoundException(Constants.getString(
                                               "jsp.error.unable.loadclass", 
                                                new Object[] {className})); 
                  }
                  return defClass(className, classBytes);
              }
  	} catch (Exception ex) {
              throw new ClassNotFoundException(Constants.getString(
  	    				     "jsp.error.unable.loadclass", 
  					      new Object[] {className}));
  	}
      }
  
      /**
       * Just a short hand for defineClass now... I suspect we might need to
       * make this public at some point of time. 
       */
      protected  Class defClass(String className, byte[] classData) {
          return defineClass(className, classData, 0, classData.length);
      }
  
      /**
       * Load JSP class data from file, method may be called from
       * within a doPriviledged if a SecurityManager is installed.
       */
      protected byte[] loadClassDataFromFile(String fileName) {
  	return doLoadClassDataFromFile( fileName );
      }
  
      /**
       * Load JSP class data from file, method may be called from
       * within a doPriviledged if a SecurityManager is installed.
       */
      protected byte[] doLoadClassDataFromFile(String fileName) {
          byte[] classBytes = null;
          try {
              FileInputStream fin = new FileInputStream(fileName);
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              byte buf[] = new byte[1024];
              for(int i = 0; (i = fin.read(buf)) != -1; )
                  baos.write(buf, 0, i);
              fin.close();
              baos.close();
              classBytes = baos.toByteArray();
          } catch(Exception ex) {
              return null;
          }
          return classBytes;
      }
  
  //     private Vector jars = new Vector();
      
      private byte[] loadClassDataFromJar(String className) {
          String entryName = className.replace('.','/')+".class";
  	InputStream classStream = null;
  	//System.out.println("Loading " + className);
  
          for(int i = 0; i < jars.size(); i++) {
              File thisFile = new File((String) jars.elementAt(i));
              try {
                  //System.out.println(" - trying " + thisFile.getAbsolutePath());
                  // check if it exists...
                  if (!thisFile.exists()) {
                      continue; 
                  };
                  
                  if (thisFile.isFile()) {
                      ZipFile zip = new ZipFile(thisFile);
                      ZipEntry entry = zip.getEntry(entryName);
                      if (entry != null) {
  			classStream = zip.getInputStream(entry);
                          byte[] classData = getClassData(classStream);
  			zip.close();
  			return classData;
  		    } else {
  			zip.close();
  		    }
                  } else { // its a directory...
                      File classFile = 
                          new File(thisFile,
                                   entryName.replace('/', File.separatorChar));
                      if (classFile.exists()) {
                          classStream = new FileInputStream(classFile);
                          byte[] classData = getClassData(classStream);
                          classStream.close();
                          return classData;
                      }
                  }
              } catch (IOException ioe) {
                  return null;
              }
          }
          
          return null;
      }
  
      private byte[] getClassData(InputStream istream) throws IOException {
  	byte[] buf = new byte[1024];
  	ByteArrayOutputStream bout = new ByteArrayOutputStream();
  	int num = 0;
  	while((num = istream.read(buf)) != -1) {
  	    bout.write(buf, 0, num);
  	}
  
  	return bout.toByteArray();
      }
  
      public String toString() {
  	return "JspLoader( " +  options.getScratchDir()   + " ) / " + parent;
      }
  
      boolean loadJSP(JspServlet jspS, String name, String classpath, 
  		    boolean isErrorPage, HttpServletRequest req,
  		    HttpServletResponse res) 
  	throws JasperException, FileNotFoundException 
      {
  	return jspS.doLoadJSP( name, classpath, isErrorPage, req, res );
      }
  
  }
  
  
  
  1.1                  jakarta-tomcat/src/share/org/apache/jasper/servlet/JasperLoader12.java
  
  Index: JasperLoader12.java
  ===================================================================
  /*
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.jasper.servlet;
  
  import java.io.FileInputStream;
  import java.io.ByteArrayOutputStream;
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.InputStream;
  import java.io.IOException;
  
  import java.util.Hashtable;
  import java.util.Vector;
  import java.util.zip.ZipFile;
  import java.util.zip.ZipEntry;
  import java.net.URL;
  
  import java.security.*;
  
  import org.apache.jasper.JasperException;
  import org.apache.jasper.Constants;
  import org.apache.jasper.JspCompilationContext;
  import org.apache.jasper.JspEngineContext;
  import org.apache.jasper.Options;
  import org.apache.jasper.compiler.Compiler;
  
  import org.apache.tomcat.logging.Logger;
  import javax.servlet.http.*;
  /**
   * 1.2 version of the JspLoader
   * 
   * @author Anil K. Vijendran
   * @author Harish Prabandham
   * @author Costin Manolache 
   */
  public class JasperLoader12 extends JasperLoader {
  
      JasperLoader12()
      {
  	super();
      }
  
      /**
       */
      protected  Class defClass(String className, byte[] classData) {
          // If a SecurityManager is being used, set the ProtectionDomain
          // for this clas when it is defined.
  	// 	System.out.println("JspLoader12: " + className + " " +
  	// 			   ((ProtectionDomain)pd).getCodeSource() );
          if( pd != null ) {
  	    return defineClass(className, classData, 0,
  			       classData.length,
  			       (ProtectionDomain)pd);
  	}
          return defineClass(className, classData, 0, classData.length);
      }
  
      protected byte[] loadClassDataFromFile( String fileName ) {
  	/**
  	 * When using a SecurityManager and a JSP page itself triggers
  	 * another JSP due to an errorPage or from a jsp:include,
  	 * the loadClass must be performed with the Permissions of
  	 * this class using doPriviledged because the parent JSP
  	 * may not have sufficient Permissions.
  	 */
  	if( System.getSecurityManager() != null ) {
  	    class doInit implements PrivilegedAction {
  		private String fileName;
  		public doInit(String file) {
  		    fileName = file;
  		}
  		public Object run() {
  		    return doLoadClassDataFromFile(fileName);
  		}
  	    }
  	    doInit di = new doInit(fileName);
  	    return (byte [])AccessController.doPrivileged(di);
  	} else {
  	    return doLoadClassDataFromFile( fileName );
  	}
      }
  
      // Hack - we want to keep JDK1.2 dependencies in fewer places,
      // and same for doPriviledged.
      boolean loadJSP(JspServlet jspS, String name, String classpath, 
  		    boolean isErrorPage, HttpServletRequest req,
  		    HttpServletResponse res) 
  	throws JasperException, FileNotFoundException 
      {
          if( System.getSecurityManager() == null ) {
  	    return jspS.doLoadJSP( name, classpath, isErrorPage, req, res );
  	}
  
  	final JspServlet jspServlet=jspS;
  	final String nameF=name;
  	final String classpathF=classpath;
  	final boolean isErrorPageF=isErrorPage;
  	final HttpServletRequest reqF=req;
  	final HttpServletResponse resF=res;
  	try {
  	    Boolean b = (Boolean)AccessController.doPrivileged(new
  		PrivilegedExceptionAction() {
  		    public Object run() throws Exception
  		    {
  			return new Boolean(jspServlet.doLoadJSP( nameF,
  								 classpathF,
  								 isErrorPageF,
  								 reqF, resF ));
  		    } 
  		});
  	    return b.booleanValue();
  	} catch( Exception ex ) {
  	    if( ex instanceof PrivilegedActionException ) 
  		ex=((PrivilegedActionException)ex).getException();
  	    
  	    if( ex instanceof JasperException )
  		throw (JasperException)ex;
  	    if( ex instanceof FileNotFoundException )
  		throw (FileNotFoundException) ex;
  	    ex.printStackTrace();
  	    throw new JasperException( ex );
  	}
      }
  
  }
  
  
  
  1.1                  jakarta-tomcat/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.jasper.servlet;
  
  import javax.servlet.Servlet;
  import javax.servlet.ServletContext;
  import javax.servlet.ServletConfig;
  import javax.servlet.ServletException;
  import javax.servlet.SingleThreadModel;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.jsp.HttpJspPage;
  import javax.servlet.jsp.JspFactory;
  
  import java.util.Hashtable;
  import java.util.Enumeration;
  import java.io.File;
  import java.io.PrintWriter;
  import java.io.IOException;
  import java.io.FileNotFoundException;
  
  import org.apache.jasper.JasperException;
  import org.apache.jasper.Constants;
  import org.apache.jasper.Options;
  import org.apache.jasper.EmbededServletOptions;
  import org.apache.jasper.JspCompilationContext;
  import org.apache.jasper.JspEngineContext;
  import org.apache.jasper.runtime.*;
  
  import org.apache.jasper.compiler.Compiler;
  
  import org.apache.tomcat.logging.Logger;
  
  /**
   * The JSP engine (a.k.a Jasper)! 
   *
   * @author Anil K. Vijendran
   * @author Harish Prabandham
   */
  public class JspServlet extends HttpServlet {
  
      class JspServletWrapper {
          Servlet theServlet;
  	String jspUri;
  	boolean isErrorPage;
  	
  	JspServletWrapper(String jspUri, boolean isErrorPage) {
  	    this.jspUri = jspUri;
  	    this.isErrorPage = isErrorPage;
  	    this.theServlet = null;
  	}
  	
  	private void load() throws JasperException, ServletException {
  	    try {  
  		Class servletClass = (Class) loadedJSPs.get(jspUri);
  
  		// This is to maintain the original protocol.
  		destroy();
  
  		theServlet = (Servlet) servletClass.newInstance();
  	    } catch (Exception ex) {
  		throw new JasperException(ex);
  	    }
  	    theServlet.init(JspServlet.this.config);
  	    if (theServlet instanceof HttpJspBase)  {
                  HttpJspBase h = (HttpJspBase) theServlet;
                  h.setClassLoader(JspServlet.this.parentClassLoader);
  	    }
  	}
  	
  	private void loadIfNecessary(HttpServletRequest req, HttpServletResponse res) 
              throws JasperException, ServletException, FileNotFoundException 
          {
              // First try context attribute; if that fails then use the 
              // classpath init parameter. 
  
              // Should I try to concatenate them if both are non-null?
  
              String cp = (String) context.getAttribute(Constants.SERVLET_CLASSPATH);
  
              String accordingto;
  
              if (cp == null || cp.equals("")) {
                  accordingto = "according to the init parameter";
                  cp = options.getClassPath();
              } else 
                  accordingto = "according to the Servlet Engine";
              
              Constants.message("jsp.message.cp_is", 
                                new Object[] { 
                                    accordingto,
                                    cp == null ? "" : cp
                                }, 
                                Logger.INFORMATION);
  
              if (loadJSP(jspUri, cp, isErrorPage, req, res) 
                      || theServlet == null) {
                  load();
              }
  	}
  	
  	public void service(HttpServletRequest request, 
  			    HttpServletResponse response,
  			    boolean precompile)
  	    throws ServletException, IOException, FileNotFoundException 
  	{
              try {
                  loadIfNecessary(request, response);
  
  		// If a page is to only to be precompiled return.
  		if (precompile)
  		    return;
  
  		if (theServlet instanceof SingleThreadModel) {
  		    // sync on the wrapper so that the freshness
  		    // of the page is determined right before servicing
  		    synchronized (this) {
  			theServlet.service(request, response);
  		    }
  		} else {
  		    theServlet.service(request, response);
  		}
  
              } catch (FileNotFoundException ex) {
  		try {
  		    response.sendError(HttpServletResponse.SC_NOT_FOUND, 
  				       Constants.getString
  				       ("jsp.error.file.not.found", 
  					new Object[] {
  					    ex.getMessage()
  					}));
  		} catch (IllegalStateException ise) {
  		    Constants.jasperLog.log(Constants.getString
  					    ("jsp.error.file.not.found",
  					     new Object[] {
  						 ex.getMessage()
  					     }), ex,
  					    Logger.ERROR);
  		}
                  return;
              }
  	}
  
  	public void destroy() {
  	    if (theServlet != null)
  		theServlet.destroy();
  	}
      }
  	
  	
      protected ServletContext context = null;
      protected Hashtable jsps = new Hashtable();
      protected Hashtable loadedJSPs = new Hashtable();
      protected ServletConfig config;
      protected JasperLoader loader;
      protected Options options;
      protected ClassLoader parentClassLoader;
      protected ServletEngine engine;
      protected String serverInfo;
  
      static boolean firstTime = true;
      static boolean jdk12=false;
      static {
  	try {
  	    Class.forName( "java.security.PrivilegedAction" );
  	    jdk12=true;
  	} catch(Throwable ex ) {
  	}
      }
  
      public void init(ServletConfig config)
  	throws ServletException
      {
  	super.init(config);
  	this.config = config;
  	this.context = config.getServletContext();
          this.serverInfo = context.getServerInfo();
          
  	options = new EmbededServletOptions(config, context);
  
  	parentClassLoader = (ClassLoader) context.getAttribute(Constants.SERVLET_CLASS_LOADER);
  	if (parentClassLoader == null)
  	    parentClassLoader = this.getClass().getClassLoader();
              
  	// getClass().getClassLoader() returns null in JDK 1.1.6/1.1.8
  	if (parentClassLoader != null) {
              Constants.message("jsp.message.parent_class_loader_is", 
                                new Object[] {
                                    parentClassLoader.toString()
                                }, Logger.DEBUG);
              }
  	else {
              Constants.message("jsp.message.parent_class_loader_is", 
                                new Object[] {
                                    "<none>"
                                }, Logger.DEBUG);
  	}
  	//	System.out.println("JspServlet: init " + config.getServletName() );
  	if( loader==null ) {
  	    if( jdk12 ) {
  		try {
  		    Class ld=Class.forName("org.apache.jasper.servlet.JasperLoader12");
  		    loader=(JasperLoader)ld.newInstance();
  		} catch(Throwable t ) {
  		    t.printStackTrace();
  		}
  	    }
  	    if( loader==null )
  		loader = new org.apache.jasper.servlet.JasperLoader();
  
  	    loader.setParentClassLoader(parentClassLoader);
  	    loader.setOptions(options);
  	    Object pd=context.getAttribute("org.apache.tomcat.protection_domain");
  	    loader.setProtectionDomain( pd );
  	}
  	if (firstTime) {
  	    firstTime = false;
  	    Constants.message("jsp.message.scratch.dir.is", 
  			      new Object[] { 
  				  options.getScratchDir().toString() 
  			      }, Logger.INFORMATION );
  	    Constants.message("jsp.message.dont.modify.servlets", Logger.INFORMATION);
  	    JspFactory.setDefaultFactory(new JspFactoryImpl());
  	}
      }
  
      private void serviceJspFile(HttpServletRequest request, 
        				HttpServletResponse response, String jspUri, 
  				Throwable exception, boolean precompile) 
  	throws ServletException, IOException
      {
  	boolean isErrorPage = exception != null;
  	
  	JspServletWrapper wrapper = (JspServletWrapper) jsps.get(jspUri);
  	if (wrapper == null) {
  	    wrapper = new JspServletWrapper(jspUri, isErrorPage);
  	    jsps.put(jspUri, wrapper);
  	}
  	
  	wrapper.service(request, response, precompile);
      }
  
  
  //     final void unknownException(HttpServletResponse response, 
  //     						Throwable t) 
  //     {
  //     	PrintWriter writer = new PrintWriter(System.err, true);
  // 	if (options.getSendErrorToClient()) {
  // 	    try {
  // 	        response.setContentType ("text/html");
  // 	    	writer = response.getWriter ();
  // 	    } catch (IOException ioex) {
  // 	        writer = new PrintWriter(System.err, true);
  // 	    }
  // 	}
  //         writer.println(Constants.getString("jsp.error.unknownException"));
  
  //         if (options.getSendErrorToClient()) {
  //             writer.println("<pre>");
  //         }
  
  // 	if (t instanceof JasperException) {
  //             Throwable x = ((JasperException) t).getRootCause();
  // 	    (x != null ? x : t).printStackTrace (writer);
  // 	} else {
  // 	    t.printStackTrace (writer);
  // 	}
  
  //         if (options.getSendErrorToClient()) {
  //             writer.println("</pre>");
  //         }
          
  // 	if (!options.getSendErrorToClient()) {
  //             try {
  // 	        String message = t.getMessage ();
  // 		if (message == null)
  // 		    message = "No detailed message";
  // 		try {
  // 		    response.sendError(HttpServletResponse.
  // 				       SC_INTERNAL_SERVER_ERROR,
  // 				       message);
  // 		} catch (IllegalStateException ise) {
  // 		    Constants.jasperLog.log(message, t, Logger.ERROR);
  // 		}
  //             } catch (IOException ex) {
  //             }
  // 	}
  //     }
  
      boolean preCompile(HttpServletRequest request) 
          throws ServletException 
      {
          boolean precompile = false;
          String precom = request.getParameter(Constants.PRECOMPILE);
          String qString = request.getQueryString();
          
          if (precom != null) {
              if (precom.equals("true")) 
                  precompile = true;
              else if (precom.equals("false")) 
                  precompile = false;
              else {
  		    // This is illegal.
  		    throw new ServletException("Can't have request parameter " +
  					       " jsp_precomile set to " + precom);
  		}
  	    }
          else if (qString != null && (qString.startsWith(Constants.PRECOMPILE) ||
                                       qString.indexOf("&" + Constants.PRECOMPILE)
                                       != -1))
              precompile = true;
  
          return precompile;
      }
      
      
  
      public void service (HttpServletRequest request, 
      			 HttpServletResponse response)
  	throws ServletException, IOException
      {
  	try {
              String includeUri 
                  = (String) request.getAttribute(Constants.INC_SERVLET_PATH);
  
              String jspUri;
  
              if (includeUri == null)
  		jspUri = request.getServletPath();
              else
                  jspUri = includeUri;
  
  //	    System.out.println("JspServletWrapper: " + includeUri + " " +
  //                            jspUri + 
  // 			       (String) request.getAttribute(
  //                                  Constants.INC_REQUEST_URI));
  
              boolean precompile = preCompile(request);
  
  	    Logger jasperLog = Constants.jasperLog;
  	    
              if (jasperLog != null &&
  		jasperLog.matchVerbosityLevel(Logger.INFORMATION))
  		{
  		    jasperLog.log("JspEngine --> "+jspUri);
  		    jasperLog.log("\t     ServletPath: "+request.getServletPath());
  		    jasperLog.log("\t        PathInfo: "+request.getPathInfo());
  		    jasperLog.log("\t        RealPath: "
  				  +getServletConfig().getServletContext().getRealPath(jspUri));
  		    jasperLog.log("\t      RequestURI: "+request.getRequestURI());
  		    jasperLog.log("\t     QueryString: "+request.getQueryString());
  		    jasperLog.log("\t  Request Params: ");
  		    Enumeration e = request.getParameterNames();
  		    while (e.hasMoreElements()) {
  			String name = (String) e.nextElement();
  			jasperLog.log("\t\t "+name+" = "+request.getParameter(name));
  		    }
  		}
              serviceJspFile(request, response, jspUri, null, precompile);
  	} catch (RuntimeException e) {
  	    throw e;
  	} catch (ServletException e) {
  	    throw e;
  	} catch (IOException e) {
  	    throw e;
  	} catch (Throwable e) {
  	    throw new ServletException(e);
  	}
  
  	// It's better to throw the exception - we don't
  	// know if we can deal with sendError ( buffer may be
  	// commited )
  	// catch (Throwable t) {
  	// 	    unknownException(response, t);
  	// 	}
      }
  
      public void destroy() {
  	if (Constants.jasperLog != null)
  	    Constants.jasperLog.log("JspServlet.destroy()", Logger.INFORMATION);
  
  	Enumeration servlets = jsps.elements();
  	while (servlets.hasMoreElements()) 
  	    ((JspServletWrapper) servlets.nextElement()).destroy();
      }
  
  
      /*  Check if we need to reload a JSP page.
       *
       *  Side-effect: re-compile the JSP page.
       *
       *  @param classpath explicitly set the JSP compilation path.
       *  @return true if JSP files is newer
       */
      boolean loadJSP(String name, String classpath, 
  	boolean isErrorPage, HttpServletRequest req, HttpServletResponse res) 
  	throws JasperException, FileNotFoundException 
      {
  	// Loader knows how to set the right priviledges, and call
  	// doLoadeJsp
  	return loader.loadJSP( this, name, classpath, isErrorPage, req, res );
      }
  
      /*  Check if we need to reload a JSP page.
       *
       *  Side-effect: re-compile the JSP page.
       *
       *  @param classpath explicitly set the JSP compilation path.
       *  @return true if JSP files is newer
       */
      protected boolean doLoadJSP(String name, String classpath, 
  	boolean isErrorPage, HttpServletRequest req, HttpServletResponse res) 
  	throws JasperException, FileNotFoundException 
      {
  	Class jspClass = (Class) loadedJSPs.get(name);
  	boolean firstTime = jspClass == null;
          JspCompilationContext ctxt = new JspEngineContext(loader, classpath,
                                                       context, name, 
                                                       isErrorPage, options,
                                                       req, res);
  	boolean outDated = false; 
  
          Compiler compiler = ctxt.createCompiler();
          
          try {
              outDated = compiler.compile();
              if ( (jspClass == null) || (compiler.isOutDated()) ) {
                  synchronized ( this ) {
                      if ((jspClass == null) || (compiler.isOutDated() ))  {
                          outDated = compiler.compile();
                      }
  		}
              }
          } catch (FileNotFoundException ex) {
              throw ex;
          } catch (JasperException ex) {
              throw ex;
          } catch (Exception ex) {
  	    throw new JasperException(Constants.getString("jsp.error.unable.compile"),
                                        ex);
  	}
  
  	// Reload only if it's outdated
  	if((jspClass == null) || outDated) {
  	    try {
  		if( null ==ctxt.getServletClassName() ) {
  		    compiler.computeServletClassName();
  		}
  		jspClass = loader.loadClass(ctxt.getFullClassName());
                          //loadClass(ctxt.getFullClassName(), true);
  	    } catch (ClassNotFoundException cex) {
  		throw new JasperException(Constants.getString("jsp.error.unable.load"), 
  					  cex);
  	    }
  	    loadedJSPs.put(name, jspClass);
  	}
  	
  	return outDated;
      }
  
  }
  
  
  
  1.1                  jakarta-tomcat/src/share/org/apache/jasper/servlet/ServletEngine.java
  
  Index: ServletEngine.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/servlet/ServletEngine.java,v 1.1 2000/06/23 21:37:32 costin Exp $
   * $Revision: 1.1 $
   * $Date: 2000/06/23 21:37:32 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  package org.apache.jasper.servlet;
  
  import java.io.File;
  
  import javax.servlet.ServletContext;
  
  /**
   * Simple class to factor out servlet runner dependencies from the JSP
   * engine. There's a few motivations here: 
   *
   *	(a) ability for the JSP engine to be able to run on multiple
   *          servlet engines - 2.1 and 2.2
   *	(b) ability for the JSP engine to take advantage of specific
   *          servlet engines; this is crucial from a J2EE point of
   *          view. 
   *
   * @author Anil K. Vijendran
   * @author Harish Prabandham
   */
  public class ServletEngine {
      static ServletEngine tomcat;
      static ServletEngine deflt;
      
      /**
       * Get a specific ServletEngine instance for the particular servlet runner
       * we are running on.
       */
      static ServletEngine getServletEngine(String serverInfo) {
          if (serverInfo.startsWith("Tomcat Web Server")) {
              if (tomcat == null) {
                  try {
                      tomcat = (ServletEngine)
                          Class.forName("org.apache.jasper.runtime.TomcatServletEngine").newInstance();
                  } catch (Exception ex) {
                      return null;
                  }
              }
              return tomcat;
          } else {
              if (deflt == null) 
                  deflt = new ServletEngine();
              return deflt;
          }
      }
      
      /**
       * Get the class loader for this ServletContext object. 
       */
      public ClassLoader getClassLoader(ServletContext ctx) {
          return null;
      }
  }
  
  
  
  
  
  
  
  
  
  1.1                  jakarta-tomcat/src/share/org/apache/jasper/servlet/TomcatServletEngine.java
  
  Index: TomcatServletEngine.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/servlet/TomcatServletEngine.java,v 1.1 2000/06/23 21:37:33 costin Exp $
   * $Revision: 1.1 $
   * $Date: 2000/06/23 21:37:33 $
   *
   * ====================================================================
   * 
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  package org.apache.jasper.servlet;
  
  import java.io.File;
  import javax.servlet.ServletContext;
  
  /**
   * Implementation of Servlet Engine that is used when the JSP engine
   * is running with Tomcat. 
   *
   * @author Anil K. Vijendran
   */
  public class TomcatServletEngine extends ServletEngine {
      public ClassLoader getClassLoader(ServletContext ctx) {
          return null;// XXX (ClassLoader)((ServletContextFacade) ctx).getRealContext().getLoader();
      }
  }
  
  
  

Mime
View raw message