Quite obviously by
design.
However, I would
find it convenient to have it do the compilation to class files as well. As
would some of the some of the HTML techs I work with. We could at least sort out
when they've done something that breaks the java with one less step. [Yes, we've
got a task to get raw java out of the jsp, but it's there
now]
JspC also knows the
correct classpath, and even emits the compiler command that it would use, if
javac was set. At least it does once TC33's JspC logging problem is
fixed.
Index:
CommandLineContext.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/CommandLineContext.java,v
retrieving revision 1.7
diff -u -w -r1.7 CommandLineContext.java
--- CommandLineContext.java 2001/01/07 19:24:12 1.7
+++ CommandLineContext.java 2001/03/22 19:04:34
@@ -68,6 +68,9 @@
import org.apache.jasper.compiler.TagLibraries;
import org.apache.jasper.compiler.CommandLineCompiler;
import org.apache.jasper.compiler.Compiler;
+import org.apache.jasper.compiler.SunJavaCompiler;
+import org.apache.jasper.compiler.JavaCompiler;
+import org.apache.tomcat.util.log.*;
//import org.apache.jasper.runtime.JspLoader;
// Use the jasper loader - the only function used is to add a jar
@@ -318,7 +321,30 @@
* compilers that are created.
*/
public Compiler createCompiler() throws JasperException {
- return new CommandLineCompiler(this);
+ String compilerPath = options.getJspCompilerPath();
+ Class jspCompilerPlugin = options.getJspCompilerPlugin();
+ JavaCompiler javac;
+
+ if (jspCompilerPlugin != null) {
+ try {
+ javac = (JavaCompiler) jspCompilerPlugin.newInstance();
+ } catch (Exception ex) {
+ Constants.message("jsp.warning.compiler.class.cantcreate",
+ new Object[] { jspCompilerPlugin, ex },
+ Log.FATAL);
+ javac = new SunJavaCompiler();
+ }
+ } else {
+ javac = new SunJavaCompiler();
+ }
+
+ if (compilerPath != null)
+ javac.setCompilerPath(compilerPath);
+
+ Compiler jspCompiler = new CommandLineCompiler(this);
+ jspCompiler.setJavaCompiler(javac);
+
+ return jspCompiler;
}
Index: JspC.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v
retrieving revision 1.21
diff -u -w -r1.21 JspC.java
--- JspC.java 2001/03/02 04:51:25 1.21
+++ JspC.java 2001/03/22 19:04:34
@@ -69,6 +69,7 @@
import org.apache.jasper.compiler.TagLibraries;
import org.apache.jasper.compiler.Compiler;
import org.apache.jasper.compiler.CommandLineCompiler;
+import org.apache.jasper.compiler.Mangler;
//import org.apache.jasper.runtime.JspLoader;
import org.apache.jasper.servlet.JasperLoader;
@@ -324,6 +325,11 @@
// QueueLogger ql = new QueueLogger();
// ql.setVerbosityLevel(verbosityLevel);
+ LogManager lm = new LogManager();
+ LogHandler lh = new LogHandler();
+ lh.setLevel(verbosityLevel);
+ lm.addChannel("JASPER_LOG", lh);
+ Log.setLogManager(lm);
Constants.jasperLog = Log.getLog("JASPER_LOG", this );
// Constants.jasperLog.setLogger( ql );
@@ -372,17 +378,17 @@
}
}
}
- CommandLineCompiler clc = new CommandLineCompiler(clctxt);
+ Compiler compiler = clctxt.createCompiler();
+ Mangler mangler = (Mangler) compiler;
+ compiler.compile();
- clc.compile();
-
targetClassName = null;
String thisServletName;
- if (clc.getPackageName() == null) {
- thisServletName = clc.getClassName();
+ if (mangler.getPackageName() == null) {
+ thisServletName = mangler.getClassName();
} else {
- thisServletName = clc.getPackageName()
- + '.' + clc.getClassName();
+ thisServletName = mangler.getPackageName()
+ + '.' + mangler.getClassName();
}
if (servletout != null) {
servletout.write("\n\t<servlet>\n\t\t<servlet-name>");
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/CommandLineContext.java,v
retrieving revision 1.7
diff -u -w -r1.7 CommandLineContext.java
--- CommandLineContext.java 2001/01/07 19:24:12 1.7
+++ CommandLineContext.java 2001/03/22 19:04:34
@@ -68,6 +68,9 @@
import org.apache.jasper.compiler.TagLibraries;
import org.apache.jasper.compiler.CommandLineCompiler;
import org.apache.jasper.compiler.Compiler;
+import org.apache.jasper.compiler.SunJavaCompiler;
+import org.apache.jasper.compiler.JavaCompiler;
+import org.apache.tomcat.util.log.*;
//import org.apache.jasper.runtime.JspLoader;
// Use the jasper loader - the only function used is to add a jar
@@ -318,7 +321,30 @@
* compilers that are created.
*/
public Compiler createCompiler() throws JasperException {
- return new CommandLineCompiler(this);
+ String compilerPath = options.getJspCompilerPath();
+ Class jspCompilerPlugin = options.getJspCompilerPlugin();
+ JavaCompiler javac;
+
+ if (jspCompilerPlugin != null) {
+ try {
+ javac = (JavaCompiler) jspCompilerPlugin.newInstance();
+ } catch (Exception ex) {
+ Constants.message("jsp.warning.compiler.class.cantcreate",
+ new Object[] { jspCompilerPlugin, ex },
+ Log.FATAL);
+ javac = new SunJavaCompiler();
+ }
+ } else {
+ javac = new SunJavaCompiler();
+ }
+
+ if (compilerPath != null)
+ javac.setCompilerPath(compilerPath);
+
+ Compiler jspCompiler = new CommandLineCompiler(this);
+ jspCompiler.setJavaCompiler(javac);
+
+ return jspCompiler;
}
Index: JspC.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v
retrieving revision 1.21
diff -u -w -r1.21 JspC.java
--- JspC.java 2001/03/02 04:51:25 1.21
+++ JspC.java 2001/03/22 19:04:34
@@ -69,6 +69,7 @@
import org.apache.jasper.compiler.TagLibraries;
import org.apache.jasper.compiler.Compiler;
import org.apache.jasper.compiler.CommandLineCompiler;
+import org.apache.jasper.compiler.Mangler;
//import org.apache.jasper.runtime.JspLoader;
import org.apache.jasper.servlet.JasperLoader;
@@ -324,6 +325,11 @@
// QueueLogger ql = new QueueLogger();
// ql.setVerbosityLevel(verbosityLevel);
+ LogManager lm = new LogManager();
+ LogHandler lh = new LogHandler();
+ lh.setLevel(verbosityLevel);
+ lm.addChannel("JASPER_LOG", lh);
+ Log.setLogManager(lm);
Constants.jasperLog = Log.getLog("JASPER_LOG", this );
// Constants.jasperLog.setLogger( ql );
@@ -372,17 +378,17 @@
}
}
}
- CommandLineCompiler clc = new CommandLineCompiler(clctxt);
+ Compiler compiler = clctxt.createCompiler();
+ Mangler mangler = (Mangler) compiler;
+ compiler.compile();
- clc.compile();
-
targetClassName = null;
String thisServletName;
- if (clc.getPackageName() == null) {
- thisServletName = clc.getClassName();
+ if (mangler.getPackageName() == null) {
+ thisServletName = mangler.getClassName();
} else {
- thisServletName = clc.getPackageName()
- + '.' + clc.getClassName();
+ thisServletName = mangler.getPackageName()
+ + '.' + mangler.getClassName();
}
if (servletout != null) {
servletout.write("\n\t<servlet>\n\t\t<servlet-name>");
<><><><><><><><><><><><><><><><><><><><><>This electronic mail transmission may contain confidential information and is intended only for the person(s) named. Any use, copying or disclosure by any other person is strictly prohibited. If you have received this transmission in error, please notify the sender via e-mail. <><><><><><><><><><><><><><><><><><><><><>