costin 01/01/25 22:45:32
Modified: src/facade22/org/apache/tomcat/facade JspInterceptor.java
Log:
Bug fix - if JspServlet is used, make sure we pass the class loader that
jasper expects and we don't use URLClassLoader ( as we have done for
JspInterceptor ). That should address the requirement that "JspServlet
should still be supported" - all tests are passing using JspServlet.
IMHO we should use JspInterceptor's and URLClassLoader for jsps, but
it's good to have a backup.
Right now 3.x is passing all sanity and watchdog in standalone/java2,
there are 7 watchdog/servlet tests failing under sandbox and many
watchdog/jsp ( all with the same error - a null pointer in TestTag.doInitBody).
I'll start testing with jdk1.1 also.
Revision Changes Path
1.8 +13 -5
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/JspInterceptor.java
Index: JspInterceptor.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/JspInterceptor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JspInterceptor.java 2001/01/22 05:50:40 1.7
+++ JspInterceptor.java 2001/01/26 06:45:32 1.8
@@ -127,10 +127,13 @@
try {
// Note: URLClassLoader in JDK1.2.2 doesn't work with file URLs
// that contain '\' characters. Insure only '/' is used.
- URL url=new URL( "file", null,
- ctx.getWorkDir().getAbsolutePath().replace('\\','/') + "/");
- ctx.addClassPath( url );
- if( debug > 9 ) log( "Added to classpath: " + url );
+ if( ! useJspServlet ) {
+ // jspServlet uses it's own mechanism
+ URL url=new URL( "file", null,
+ ctx.getWorkDir().getAbsolutePath().replace('\\','/') + "/");
+ ctx.addClassPath( url );
+ if( debug > 9 ) log( "Added to classpath: " + url );
+ }
} catch( MalformedURLException ex ) {
}
@@ -197,6 +200,9 @@
}
if( useJspServlet ) {
+ // this code can be optimized - but it's tiny compared
+ // with what happens in jsp servlet ( compiling a java
+ // program or the jspServlet overhead )
ServletHandler jspServlet=(ServletHandler)wrapper;
if( ! "jsp".equals( jspServlet.getServletClassName()) )
return 0; // it's all set, the JspServlet will do the job.
@@ -214,7 +220,9 @@
// is not setup
jspServlet.
setServletClassName("org.apache.jasper.servlet.JspServlet");
-
+ Context ctx=req.getContext();
+ ctx.setAttribute( "org.apache.tomcat.classloader",
+ ctx.getClassLoader());
// XXX set the options
// jspServlet.getServletInfo().addInitParam("jspCompilerPlugin",
// "org.apache.jasper.compiler.JikesJavaCompiler");
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]