cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Lamb <p...@oil-law.com>
Subject [Patch] allows xsp to compile under catalina & tomcat 3.3
Date Mon, 09 Oct 2000 03:23:34 GMT
This allows the xsp compiler to use the classpath exposed by the latest
catalina or tomcat. I can't say that I really like this, but there doesn't
seem to be an alternative.

Paul Lamb


Index: xml-cocoon/src/org/apache/cocoon/processor/xsp/XSPProcessor.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon/src/org/apache/cocoon/processor/xsp/XSPProcessor.
java,v
retrieving revision 1.25
diff -u -r1.25 XSPProcessor.java
--- xml-cocoon/src/org/apache/cocoon/processor/xsp/XSPProcessor.java
2000/08/18 22:43:15	1.25
+++ xml-cocoon/src/org/apache/cocoon/processor/xsp/XSPProcessor.java
2000/10/09 03:16:53
@@ -206,6 +206,15 @@
         + ". Make sure you have writing permissions.");
     }
 
+    String classpath = (String)
this.servletContext.getAttribute("org.apache.catalina.jsp_classpath");
+    if (classpath == null) {
+        classpath = (String)
this.servletContext.getAttribute("org.apache.tomcat.jsp_classpath");
+    }
+    if( classpath == null ) {
+        classpath = System.getProperty("java.class.path");
+    }
+
+    
     // Set repository for each language processor
     Enumeration enum = this.languages.elements();
     while (enum.hasMoreElements()) {
@@ -215,6 +224,7 @@
       try {
         languageProcessor.setEncoding(this.encoding);
         languageProcessor.setRepository(this.repositoryFile);
+        languageProcessor.setClassPath(classpath);
       } catch (Exception e) {
         throw new RuntimeException(
           "Error setting repository for language processor: " +


Index:
xml-cocoon/src/org/apache/cocoon/processor/xsp/language/XSPLanguageProcessor
.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon/src/org/apache/cocoon/processor/xsp/language/XSPL
anguageProcessor.java,v
retrieving revision 1.5
diff -u -r1.5 XSPLanguageProcessor.java
---
xml-cocoon/src/org/apache/cocoon/processor/xsp/language/XSPLanguageProcessor
.java	2000/05/07 00:43:57	1.5
+++
xml-cocoon/src/org/apache/cocoon/processor/xsp/language/XSPLanguageProcessor
.java	2000/10/09 03:16:54
@@ -52,8 +52,8 @@
 package org.apache.cocoon.processor.xsp.language;
 
 import java.io.File;
-import org.w3c.dom.Document;
-import javax.servlet.http.HttpServletRequest;
+//import org.w3c.dom.Document;
+//import javax.servlet.http.HttpServletRequest;
 
 import org.apache.cocoon.processor.xsp.*;
 
@@ -70,6 +70,8 @@
 
   public void setFormatOption(boolean format);
   public String formatCode(String code) throws Exception;
+  
+  public void setClassPath(String classpath);
 
   public void compile(String filename) throws Exception;
 

Index:
xml-cocoon/src/org/apache/cocoon/processor/xsp/language/java/XSPJavaProcesso
r.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon/src/org/apache/cocoon/processor/xsp/language/java
/XSPJavaProcessor.java,v
retrieving revision 1.11
diff -u -r1.11 XSPJavaProcessor.java
---
xml-cocoon/src/org/apache/cocoon/processor/xsp/language/java/XSPJavaProcesso
r.java	2000/08/18 22:43:59	1.11
+++
xml-cocoon/src/org/apache/cocoon/processor/xsp/language/java/XSPJavaProcesso
r.java	2000/10/09 03:16:54
@@ -69,6 +69,7 @@
   protected String encoding;
   protected XSPClassLoader classLoader;
   protected JavaCompiler javac;
+  protected String classpath;
 
   protected boolean format;
 
@@ -112,6 +113,10 @@
     // or similar to allow easier XSP code debugging (SM)
     return code;
   }
+  
+  public void setClassPath(String classpath) {
+	  this.classpath = classpath;
+  }
 
   public void compile(String filename) throws Exception {
     String repositoryName = this.repository.getCanonicalPath();
@@ -120,7 +125,7 @@
     ByteArrayOutputStream err = new ByteArrayOutputStream(256);
     
     javac.setEncoding(this.encoding);
-    javac.setClasspath(repositoryName + File.pathSeparator +
System.getProperty("java.class.path"));
+    javac.setClasspath(repositoryName + File.pathSeparator +
this.classpath);
     javac.setOutputDir(repositoryName);
     javac.setMsgOutput(err);
 

Mime
View raw message