You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2003/04/12 00:41:58 UTC

cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JasperLoader.java JspServletWrapper.java

kinman      2003/04/11 15:41:58

  Modified:    jasper2/src/share/org/apache/jasper JspC.java
                        JspCompilationContext.java
               jasper2/src/share/org/apache/jasper/compiler Compiler.java
               jasper2/src/share/org/apache/jasper/resources
                        messages.properties
               jasper2/src/share/org/apache/jasper/servlet
                        JasperLoader.java JspServletWrapper.java
  Log:
  - Put generate .class files in packages that mirror JSP file heirachy.
  - Modified JasperLoader accordingly.
  - Refactor some codes in Jspc and JspCompilationContext to shared more code.
  - Numerous fixes and mods.
  
  WARNING: All JSP pages need to be recompiled!
  
  Revision  Changes    Path
  1.39      +5 -144    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- JspC.java	3 Apr 2003 19:45:50 -0000	1.38
  +++ JspC.java	11 Apr 2003 22:41:57 -0000	1.39
  @@ -122,7 +122,6 @@
       private static final String SWITCH_VERBOSE = "-v";
       private static final String SWITCH_QUIET = "-q";
       private static final String SWITCH_OUTPUT_DIR = "-d";
  -    private static final String SWITCH_OUTPUT_SIMPLE_DIR = "-dd";
       private static final String SWITCH_IE_CLASS_ID = "-ieplugin";
       private static final String SWITCH_PACKAGE_NAME = "-p";
       private static final String SWITCH_CLASS_NAME = "-c";
  @@ -143,20 +142,7 @@
       private static final int DEFAULT_DIE_LEVEL = 1;
       private static final int NO_DIE_LEVEL = 0;
   
  -    private static final String javaKeywords[] = {
  -	"abstract", "boolean", "break", "byte", "case",
  -	"catch", "char", "class", "const", "continue",
  -	"default", "do", "double", "else", "extends",
  -	"final", "finally", "float", "for", "goto",
  -	"if", "implements", "import", "instanceof", "int",
  -	"interface", "long", "native", "new", "package",
  -	"private", "protected", "public", "return", "short",
  -	"static", "strictfp", "super", "switch", "synchronized",
  -	"this", "throws", "transient", "try", "void",
  -	"volatile", "while" };
  -
       private static int die; 
  -
       private String classPath = null;
       private URLClassLoader loader = null;
       private boolean largeFile = false;
  @@ -172,7 +158,6 @@
   
       private boolean compile = false;
       private String compiler = null;
  -    private boolean dirset;
       private boolean classDebugInfo = true;
       private Vector extensions;
       private Vector pages = new Vector();
  @@ -239,18 +224,6 @@
               } else if (tok.equals(SWITCH_OUTPUT_DIR)) {
                   tok = nextArg();
                   setOutputDir( tok );
  -            } else if (tok.equals(SWITCH_OUTPUT_SIMPLE_DIR)) {
  -                tok = nextArg();
  -                if (tok != null) {
  -                    scratchDir = new File(new File(tok).getAbsolutePath());
  -                    dirset = false;
  -                } else {
  -                    // either an in-java call with an explicit null
  -                    // or a "-d --" sequence should cause this,
  -                    // which would mean default handling
  -                    /* no-op */
  -                    scratchDir = null;
  -                }
               } else if (tok.equals(SWITCH_PACKAGE_NAME)) {
                   targetPackage = nextArg();
               } else if (tok.equals(SWITCH_COMPILE)) {
  @@ -457,8 +430,7 @@
   
       public void setOutputDir( String s ) {
           if( s!= null ) {
  -            scratchDir=new File(new File(s).getAbsolutePath());
  -            dirset=true;
  +            scratchDir = new File(s).getAbsoluteFile();
           } else {
               scratchDir=null;
           }
  @@ -540,9 +512,6 @@
               }
   
               String jspUri=file.replace('\\','/');
  -            String baseDir = scratchDir.getCanonicalPath();
  -            this.setOutputDir(baseDir
  -			      + jspUri.substring(0, jspUri.lastIndexOf('/')));
               JspCompilationContext clctxt = new JspCompilationContext
                   ( jspUri, false,  this, context, null, rctxt );
   
  @@ -552,19 +521,9 @@
                   targetClassName = null;
               }
               if (targetPackage != null) {
  -                String jspPackage = toPackageName(jspUri);
  -                if (jspPackage.equals("")) {
  -                    clctxt.setServletPackageName(targetPackage);
  -                } else {
  -                    clctxt.setServletPackageName(targetPackage + "." 
  -                                                 + jspPackage);
  -                }
  -            } else {
  -                clctxt.setServletPackageName( toPackageName(jspUri));
  +                clctxt.setServletPackageName(targetPackage);
               }
   
  -            setupContext(clctxt);
  -
               if( loader==null )
                   initClassLoader( clctxt );
   
  @@ -572,7 +531,6 @@
               clctxt.setClassPath(classPath);
   
               Compiler clc = clctxt.createCompiler();
  -            this.setOutputDir( baseDir );
   
               // If compile is set, generate both .java and .class, if
               // .jsp file is newer than .class file;
  @@ -730,42 +688,6 @@
           }
       }
   
  -    /**
  -     * Converts the JSP file path into a valid package name with a
  -     * structure that mirrors the directory structure. If the JSP file
  -     * path doesn't contain a directory structure (top-level file),
  -     * an empty package name is returned.
  -     *
  -     * @param jspUri the context-relative path for the JSP file, starting
  -     *  with a slash
  -     */
  -    private String toPackageName(String jspUri) {
  -        StringBuffer modifiedPackageName = new StringBuffer();
  -        int iSep = jspUri.lastIndexOf('/');
  -	// Start after the first slash
  -        int nameStart = 1;
  -	for (int i = 1; i < iSep; i++) {
  -	    char ch = jspUri.charAt(i);
  -	    if (Character.isJavaIdentifierPart(ch)) {
  -		modifiedPackageName.append(ch);
  -	    }
  -	    else if (ch == '/') {
  -                if (isJavaKeyword(jspUri.substring(nameStart, i))) {
  -                    modifiedPackageName.append('_');
  -                }
  -                nameStart = i+1;
  -		modifiedPackageName.append('.');
  -	    } else {
  -		modifiedPackageName.append(mangleChar(ch));
  -	    }
  -	}
  -        if (nameStart < iSep
  -	        && isJavaKeyword(jspUri.substring(nameStart, iSep))) {
  -            modifiedPackageName.append('_');
  -        }
  -        return modifiedPackageName.toString();
  -    }
  -
       private void initWebXml() {
           try {
               if (webxmlLevel >= INC_WEBXML) {
  @@ -824,49 +746,6 @@
           tagPluginManager = new TagPluginManager(context);
       }
   
  -    /**
  -     * Mangle the specified character to create a legal Java class name.
  -     * FIX: This is a copy of the method from JspCompilationContext. It
  -     * would be better to make that method public, or put it in a utility
  -     * class.
  -     */
  -    private String mangleChar(char ch) {
  -
  -	String s = Integer.toHexString(ch);
  -	int nzeros = 5 - s.length();
  -	char[] result = new char[6];
  -	result[0] = '_';
  -	for (int i = 1; i <= nzeros; i++) {
  -	    result[i] = '0';
  -        }
  -	for (int i = nzeros+1, j = 0; i < 6; i++, j++) {
  -	    result[i] = s.charAt(j);
  -        }
  -	return new String(result);
  -    }
  -
  -    /**
  -     * Resolve relative path, and create output directories.
  -     */
  -    private void setupContext(JspCompilationContext clctxt) {
  -        String outputDir = scratchDir.getAbsolutePath();
  -
  -        if (dirset) {
  -            int indexOfSlash = clctxt.getJspFile().lastIndexOf('/');
  -
  -            /* String pathName = "";
  -            if (indexOfSlash != -1) {
  -                pathName = clctxt.getJspFile().substring(0, indexOfSlash);
  -            } */
  -            String tmpDir = outputDir + File.separatorChar; // + pathName;
  -            File f = new File(tmpDir);
  -            if (!f.exists()) {
  -                f.mkdirs();
  -            }
  -        }
  -        clctxt.setOutputDir( outputDir );
  -    }
  -
       private void initClassLoader(JspCompilationContext clctxt)
   	    throws IOException {
   
  @@ -1013,24 +892,6 @@
               // for uriRoot has a non-error meaning, we can just
               // pass straight through
           }
  -    }
  -
  -    private static boolean isJavaKeyword(String key) {
  -	int i = 0;
  -	int j = javaKeywords.length;
  -	while (i < j) {
  -	    int k = (i+j)/2;
  -	    int result = javaKeywords[k].compareTo(key);
  -	    if (result == 0) {
  -		return true;
  -	    }
  -	    if (result < 0) {
  -		i = k+1;
  -	    } else {
  -		j = k;
  -	    }
  -	}
  -	return false;
       }
   }
   
  
  
  
  1.37      +124 -82   jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java
  
  Index: JspCompilationContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- JspCompilationContext.java	1 Apr 2003 03:14:52 -0000	1.36
  +++ JspCompilationContext.java	11 Apr 2003 22:41:57 -0000	1.37
  @@ -87,6 +87,7 @@
    * @author Harish Prabandham
    * @author Pierre Delisle
    * @author Costin Manolache
  + * @author Kin-man Chung
    */
   public class JspCompilationContext {
   
  @@ -96,9 +97,10 @@
       private String className;
       private String jspUri;
       private boolean isErrPage;
  -    private String servletPackageName;
  +    private String basePackageName;
  +    private String derivedPackageName;
       private String servletJavaFileName;
  -    private String jspPath;
  +    private String javaPath;
       private String classFileName;
       private String contentType;
       private ServletWriter writer;
  @@ -108,6 +110,7 @@
       private String classPath;
   
       private String baseURI;
  +    private String baseOutputDir;
       private String outputDir;
       private ServletContext context;
       private URLClassLoader loader;
  @@ -117,7 +120,7 @@
       private int removed = 0;
   
       private URLClassLoader jspLoader;
  -    private URL[] outUrls;
  +    private URL baseUrl;
       private Class servletClass;
   
       private boolean isTagFile;
  @@ -125,6 +128,19 @@
       private TagInfo tagInfo;
       private JarFile tagFileJar;
   
  +    private static final String javaKeywords[] = {
  +        "abstract", "boolean", "break", "byte", "case",
  +        "catch", "char", "class", "const", "continue",
  +        "default", "do", "double", "else", "extends",
  +        "final", "finally", "float", "for", "goto",
  +        "if", "implements", "import", "instanceof", "int",
  +        "interface", "long", "native", "new", "package",
  +        "private", "protected", "public", "return", "short",
  +        "static", "strictfp", "super", "switch", "synchronized",
  +        "this", "throws", "transient", "try", "void",
  +        "volatile", "while" };
  +
  +
       // jspURI _must_ be relative to the context
       public JspCompilationContext(String jspUri,
                                    boolean isErrPage,
  @@ -154,8 +170,7 @@
   
           this.rctxt = rctxt;
           this.tagFileJars = new Hashtable();
  -        this.servletPackageName = Constants.JSP_PACKAGE_NAME;
  -        this.outUrls = new URL[2];
  +        this.basePackageName = Constants.JSP_PACKAGE_NAME;
       }
   
       public JspCompilationContext(String tagfile,
  @@ -211,14 +226,16 @@
       /** ---------- Input/Output  ---------- */
       
       /**
  -     * The scratch directory to generate code into.
  +     * The output directory to generate code into.  The output directory
  +     * is make up of the scratch directory, which is provide in Options,
  +     * plus the directory derived from the package name.
        */
       public String getOutputDir() {
  -        return outputDir;
  -    }
  +	if (outputDir == null) {
  +	    createOutputDir();
  +	}
   
  -    public void setOutputDir(String s) {
  -        this.outputDir = s;
  +        return outputDir;
       }
   
       /**
  @@ -396,17 +413,57 @@
       }
   
       /**
  -     * Package name for the generated class.
  +     * Package name for the generated class is make up of the base package
  +     * name, which is user settable, and the derived package name.  The
  +     * derived package name directly mirrors the file heirachy of the JSP page.
        */
       public String getServletPackageName() {
  -        return servletPackageName;
  +        String dPackageName = getDerivedPackageName();
  +	if (dPackageName.length() == 0) {
  +            return basePackageName;
  +        }
  +        return basePackageName + '.' + getDerivedPackageName();
       }
   
  +    private String getDerivedPackageName() {
  +	if (derivedPackageName == null) {
  +            StringBuffer modifiedPackageName = new StringBuffer();
  +            int iSep = jspUri.lastIndexOf('/');
  +            // Start after the first slash
  +            int nameStart = 1;
  +            for (int i = 1; i < iSep; i++) {
  +                char ch = jspUri.charAt(i);
  +                if (i == nameStart) {
  +		    if (! Character.isJavaIdentifierStart(ch) || ch == '_') {
  +                        modifiedPackageName.append('_');
  +                    }
  +                    modifiedPackageName.append(ch);
  +                } else if (Character.isJavaIdentifierPart(ch)) {
  +                    modifiedPackageName.append(ch);
  +                } else if (ch == '/') {
  +                    if (isJavaKeyword(jspUri.substring(nameStart, i))) {
  +                        modifiedPackageName.append('_');
  +                    }
  +                    nameStart = i+1;
  +                    modifiedPackageName.append('.');
  +                } else {
  +                    modifiedPackageName.append(mangleChar(ch));
  +                }
  +            }
  +            if (nameStart < iSep
  +                    && isJavaKeyword(jspUri.substring(nameStart, iSep))) {
  +                modifiedPackageName.append('_');
  +            }
  +            derivedPackageName = modifiedPackageName.toString();
  +        }
  +        return derivedPackageName;
  +    }
  +	    
       /**
        * The package name into which the servlet class is generated.
        */
       public void setServletPackageName(String servletPackageName) {
  -        this.servletPackageName = servletPackageName;
  +        this.basePackageName = servletPackageName;
       }
   
       /**
  @@ -415,19 +472,10 @@
        */
       public String getServletJavaFileName() {
   
  -        if (servletJavaFileName != null) {
  -            return servletJavaFileName;
  -        }
  -
  -        String outputDir = getOutputDir();
  -        servletJavaFileName = getServletClassName() + ".java";
  -        if (outputDir != null && !outputDir.equals("")) {
  -            if( outputDir.endsWith("/" ) ) {
  -                servletJavaFileName = outputDir + servletJavaFileName;
  -            } else {
  -                servletJavaFileName = outputDir + "/" + servletJavaFileName;
  -            }
  -        }
  +        if (servletJavaFileName == null) {
  +            servletJavaFileName =
  +		getOutputDir() + getServletClassName() + ".java";
  +	}
           return servletJavaFileName;
       }
   
  @@ -451,43 +499,28 @@
       }
   
       /**
  -     * Path of the JSP relative to the work directory.
  +     * Path of the Java file relative to the work directory.
        */
  -    public String getJspPath() {
  -        if (jspPath != null) {
  -            return jspPath;
  -        }
  +    public String getJavaPath() {
   
  -        if (isTagFile) {
  -            jspPath = "tags/"
  -                + tagInfo.getTagClassName().replace('.', '/')
  -                + ".java";
  -        } else {
  -            String dirName = getJspFile();
  -            int pos = dirName.lastIndexOf('/');
  -            if (pos > 0) {
  -                dirName = dirName.substring(0, pos + 1);
  -            } else {
  -                dirName = "";
  -            }
  -            jspPath = dirName + getServletClassName() + ".java";
  -            if (jspPath.startsWith("/")) {
  -                jspPath = jspPath.substring(1);
  -            }
  +        if (javaPath != null) {
  +            return javaPath;
           }
   
  -        return jspPath;
  +        if (isTagFile()) {
  +	    String tagName = tagInfo.getTagClassName();
  +            javaPath = tagName.replace('.', '/') + ".java";
  +        } else {
  +            javaPath = getServletPackageName().replace('.', '/') + '/' +
  +                       getServletClassName() + ".java";
  +	}
  +        return javaPath;
       }
   
       public String getClassFileName() {
  -        if (classFileName != null) {
  -            return classFileName;
  -        }
   
  -        String outputDir = getOutputDir();
  -        classFileName = getServletClassName() + ".class";
  -        if (outputDir != null && !outputDir.equals("")) {
  -            classFileName = outputDir + File.separatorChar + classFileName;
  +        if (classFileName == null) {
  +            classFileName = getOutputDir() + getServletClassName() + ".class";
           }
           return classFileName;
       }
  @@ -581,8 +614,7 @@
       {
           try {
               jspLoader = new JasperLoader
  -                (outUrls,
  -                 getServletPackageName() + "." + getServletClassName(),
  +                (new URL[] {baseUrl},
                    getClassLoader(),
                    rctxt.getPermissionCollection(),
                    rctxt.getCodeSource());
  @@ -605,35 +637,27 @@
           return servletClass;
       }
   
  -    public void createOutdir(String dirPath) {
  +    private void createOutputDir() {
  +
  +        String path = null;
  +        if (isTagFile()) {
  +	    String tagName = tagInfo.getTagClassName();
  +            path = tagName.replace('.', '/');
  +	    path = path.substring(0, path.lastIndexOf('/'));
  +        } else {
  +            path = getServletPackageName().replace('.', '/');
  +	}
   
           try {
               // Append servlet or tag handler path to scratch dir
  -            URL outUrl = options.getScratchDir().toURL();
  -            String outUrlString = outUrl.toString();
  -            if (outUrlString.endsWith("/")) {
  -                outUrlString += dirPath.substring(1,
  -                                                  dirPath.lastIndexOf("/")+1);
  -            } else {
  -                outUrlString += dirPath.substring(0,
  -                                                  dirPath.lastIndexOf("/")+1);
  -            }
  -            outUrl = new URL(outUrlString);
  +            baseUrl = options.getScratchDir().toURL();
  +            String outUrlString = baseUrl.toString() + '/' + path;
  +            URL outUrl = new URL(outUrlString);
               File outDirFile = new File(outUrl.getFile());
               if (!outDirFile.exists()) {
                   outDirFile.mkdirs();
               }
  -            this.outputDir = outDirFile.toString() + File.separator;
  -            
  -            // Populate the URL array with the URLs from which to load the
  -            // generated servlet and tag handler classes. The URL array is
  -            // passed to our org.apache.jasper.servlet.JasperLoader, which 
  -            // extends URLClassLoader
  -            outUrls[0] = new URL(outDirFile.toURL().toString()
  -                                 + File.separator);
  -            outUrls[1] = new URL("file:" + options.getScratchDir()
  -                                 + File.separator + "tags"
  -                                 + File.separator);
  +            outputDir = outDirFile.toString() + File.separator;
           } catch (Exception e) {
               throw new IllegalStateException("No output directory: " +
                                               e.getMessage());
  @@ -722,6 +746,24 @@
              ++pos;
          }
          return result.toString();
  +    }
  +
  +    private static boolean isJavaKeyword(String key) {
  +        int i = 0;
  +        int j = javaKeywords.length;
  +        while (i < j) {
  +            int k = (i+j)/2;
  +            int result = javaKeywords[k].compareTo(key);
  +            if (result == 0) {
  +                return true;
  +            }
  +            if (result < 0) {
  +                i = k+1;
  +            } else {
  +                j = k;
  +            }
  +        }
  +        return false;
       }
   
   }
  
  
  
  1.63      +2 -2      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- Compiler.java	28 Mar 2003 23:15:45 -0000	1.62
  +++ Compiler.java	11 Apr 2003 22:41:57 -0000	1.63
  @@ -378,8 +378,8 @@
           // Build includes path
           PatternSet.NameEntry includes = javac.createInclude();
   
  -        includes.setName(ctxt.getJspPath());
  -        info.append("    include="+ ctxt.getJspPath() + "\n" );
  +        includes.setName(ctxt.getJavaPath());
  +        info.append("    include="+ ctxt.getJavaPath() + "\n" );
   
           try {
               if (ctxt.getOptions().getFork()) {
  
  
  
  1.113     +3 -7      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v
  retrieving revision 1.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- messages.properties	8 Apr 2003 20:58:59 -0000	1.112
  +++ messages.properties	11 Apr 2003 22:41:58 -0000	1.113
  @@ -192,10 +192,8 @@
   \    -webapp <dir>  A directory containing a web-app, all jsp pages\n\
   \                   will recursivly be parsed\n\
   where options include:\n\
  -\    -q          Quite mode (same as -v0)\n\
  -\    -v[#]       Verbose mode (optional number is level, default is 2)\n\
  +\    -v          Verbose mode\n\
   \    -d <dir>    Output Directory\n\
  -\    -dd <dir>   Literal Output Directory.  (package dirs will not be made)\n\
   \    -l          Outputs the name of the JSP page upon failure\n\
   \    -s          Outputs the name of the JSP page upon success\n\
   \    -p <name>   Name of target package (default is org.apache.jsp).\n\
  @@ -206,13 +204,11 @@
   \                If the number is absent or unparsable it defaults to 1.\n\
   \    -uribase <dir>  The uri directory compilations should be relative to\n\
   \                    (Default is "/").\n\
  -\    -uriroot <dir>  The root directory that uri files should be resolved\n\
  -\                    against, (Default is the directory jspc is invoked from)\n\
  +\    -uriroot <dir>  same as -webapps
   \    -compile        Compile generated servlets.\n\
   \    -webinc <file>  Creates partial servlet mappings for the -webapp option.\n\
   \    -webxml <file>  Creates a complete web.xml when using the -webapp option.\n\
   \    -ieplugin <clsid>  Java Plugin classid for Internet Explorer\n\
  -\    -sax2 <driverclassname>  Driver class name for the SAX 2.0 parser to be used\n\
   
   jspc.webxml.header=<?xml version="1.0" encoding="ISO-8859-1"?>\n\
   \n\
  
  
  
  1.9       +2 -68     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JasperLoader.java
  
  Index: JasperLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JasperLoader.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JasperLoader.java	27 Feb 2003 22:51:38 -0000	1.8
  +++ JasperLoader.java	11 Apr 2003 22:41:58 -0000	1.9
  @@ -57,9 +57,6 @@
   
   package org.apache.jasper.servlet;
   
  -import java.io.ByteArrayOutputStream;
  -import java.io.InputStream;
  -import java.io.IOException;
   import java.net.URL;
   import java.net.URLClassLoader;
   import java.security.AccessController;
  @@ -92,13 +89,12 @@
       private SecurityManager securityManager;
       private PrivilegedLoadClass privLoadClass;
   
  -    public JasperLoader(URL[] urls, String className, ClassLoader parent,
  +    public JasperLoader(URL[] urls, ClassLoader parent,
   			PermissionCollection permissionCollection,
   			CodeSource codeSource) {
   	super(urls, parent);
   	this.permissionCollection = permissionCollection;
   	this.codeSource = codeSource;
  -	this.className = className;
   	this.parent = parent;
           this.privLoadClass = new PrivilegedLoadClass();
   	this.securityManager = System.getSecurityManager();
  @@ -197,33 +193,7 @@
   	    return clazz;
   	}
   
  -	// Only load classes for this JSP page (including any tag handlers
  -	// generated from tag files)
  -	if (name.startsWith(className)) {
  -	    String classFile
  -		= name.substring(Constants.JSP_PACKAGE_NAME.length() + 1)
  -		+ ".class";
  -	    byte[] cdata = loadClassDataFromFile(classFile);
  -	    if (cdata == null) {
  -		throw new ClassNotFoundException(name);
  -	    }
  -	    if (securityManager != null) {
  -		ProtectionDomain pd
  -		    = new ProtectionDomain(codeSource, permissionCollection);
  -		clazz = defineClass(name, cdata, 0, cdata.length, pd);
  -	    } else {
  -		clazz = defineClass(name, cdata, 0, cdata.length);
  -	    }
  -	    if (clazz != null) {
  -		if (resolve)                
  -		    resolveClass(clazz);
  -		return clazz;
  -	    }
  -	} else if (name.startsWith(Constants.TAG_FILE_PACKAGE_NAME)) {
  -	    return findClass(name);
  -	}
  -
  -	throw new ClassNotFoundException(name);
  +	return findClass(name);
       }
   
       /**
  @@ -238,42 +208,6 @@
        */
       public final PermissionCollection getPermissions(CodeSource codeSource) {
           return permissionCollection;
  -    }
  -
  -    /*
  -     * Load JSP class data from file.
  -     */
  -    private byte[] loadClassDataFromFile(final String fileName) {
  -        byte[] classBytes = null;
  -        try {
  -            InputStream in = null;
  -            
  -            if (System.getSecurityManager() != null){
  -                in = (InputStream)AccessController.doPrivileged(new PrivilegedAction(){
  -                    public Object run(){
  -                        return getResourceAsStream(fileName);
  -                    }
  -                });
  -            } else {
  -                in = getResourceAsStream(fileName);
  -            }
  -            
  -            if (in == null) {
  -		return null;
  -	    }
  -            ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -            byte buf[] = new byte[1024];
  -            for (int i = 0; (i = in.read(buf)) != -1; ) {
  -                baos.write(buf, 0, i);
  -	    }
  -            in.close();     
  -            baos.close();    
  -            classBytes = baos.toByteArray();
  -        } catch(Exception ex) {
  -	    ex.printStackTrace();
  -            return null;     
  -        }                    
  -        return classBytes;
       }
   
       private class PrivilegedLoadClass implements PrivilegedAction {
  
  
  
  1.29      +3 -6      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java
  
  Index: JspServletWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- JspServletWrapper.java	12 Feb 2003 16:37:11 -0000	1.28
  +++ JspServletWrapper.java	11 Apr 2003 22:41:58 -0000	1.29
  @@ -140,7 +140,6 @@
           ctxt = new JspCompilationContext(jspUri, isErrorPage, options,
   					 config.getServletContext(),
   					 this, rctxt);
  -        ctxt.createOutdir(jspUri);
       }
   
       /*
  @@ -162,8 +161,6 @@
           ctxt = new JspCompilationContext(jspUri, tagInfo, options,
   					 servletContext, this, rctxt,
   					 tagFileJar);
  -        ctxt.createOutdir("/tags/"
  -			  + tagInfo.getTagClassName().replace('.', '/'));
       }
   
       public JspCompilationContext getJspEngineContext() {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org