glenn 01/02/03 17:04:53
Modified: jasper/src/share/org/apache/jasper/compiler Compiler.java
Log:
- Implemented Java SecurityManager
- Switched to using URLClassLoader
Jasper now creates a URLClassLoader for each JSP page and defers any other
class loading to the web app context class loader. Using a single class
loader per JSP allowed me to remove all the code that increments the
class version number, i.e. the work directory no longer has multiple
*.java and *.class files for the same JSP page. These changes also made
it easy for me to put the java source and class files in the same directory
tree as found in the web app context. When Jasper is run in a servlet
container it no longer puts the class files in a package, they are now
in the default package.
Revision Changes Path
1.8 +7 -38
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java
Index: Compiler.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Compiler.java 2001/01/05 22:33:02 1.7
+++ Compiler.java 2001/02/04 01:04:52 1.8
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
1.7 2001/01/05 22:33:02 horwat Exp $
- * $Revision: 1.7 $
- * $Date: 2001/01/05 22:33:02 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
1.8 2001/02/04 01:04:52 glenn Exp $
+ * $Revision: 1.8 $
+ * $Date: 2001/02/04 01:04:52 $
*
* ====================================================================
*
@@ -107,24 +107,17 @@
public boolean compile()
throws FileNotFoundException, JasperException, Exception
{
- String pkgName = mangler.getPackageName();
String classFileName = mangler.getClassFileName();
- ctxt.setServletPackageName(pkgName);
- Constants.message("jsp.message.package_name_is",
- new Object[] { (pkgName==null)?
- "[default package]":pkgName },
- Logger.DEBUG);
- Constants.message("jsp.message.class_file_name_is",
- new Object[] { classFileName },
+ String className = mangler.getClassName();
+ ctxt.setServletClassName(className);
+ Constants.message("jsp.message.class_name_is",
+ new Object[] { className },
Logger.DEBUG);
if (!isOutDated())
return false;
- // Hack to avoid readign the class file every time -
- // getClassName() is an _expensive_ operation, and it's needed only
- // if isOutDated() return true.
String javaFileName = mangler.getJavaFileName();
ctxt.setServletJavaFileName(javaFileName);
@@ -132,12 +125,6 @@
new Object[] { javaFileName },
Logger.DEBUG);
- String className = mangler.getClassName();
- ctxt.setServletClassName(className);
- Constants.message("jsp.message.class_name_is",
- new Object[] { className },
- Logger.DEBUG);
-
// Setup the ServletWriter
// We try UTF8 by default. If it fails, we use the java encoding
// specified for JspServlet init parameter "javaEncoding".
@@ -224,12 +211,10 @@
listener.beginPageProcessing();
listener.endPageProcessing();
writer.close();
-
// An XML input stream has been produced and can be validated
// by TagLibraryValidator classes
((JspParseEventListener)listener).validate();
-
String classpath = ctxt.getClassPath();
// I'm nuking
@@ -296,9 +281,6 @@
}
String classFile = ctxt.getOutputDir() + File.separatorChar;
- if (pkgName != null && !pkgName.equals(""))
- classFile = classFile + pkgName.replace('.', File.separatorChar) +
- File.separatorChar;
classFile = classFile + className + ".class";
if (!classFile.equals(classFileName)) {
@@ -317,17 +299,6 @@
return true;
}
- public void computeServletClassName() {
- // Hack to avoid readign the class file every time -
- // getClassName() is an _expensive_ operation, and it's needed only
- // if isOutDated() return true.
- String className = mangler.getClassName();
- ctxt.setServletClassName(className);
- Constants.message("jsp.message.class_name_is",
- new Object[] { className },
- Logger.DEBUG);
- }
-
/**
* This is a protected method intended to be overridden by
* subclasses of Compiler. This is used by the compile method
@@ -404,5 +375,3 @@
}
}
}
-
-
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]