You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/07/09 09:42:24 UTC
cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap PipelineNode.java
cziegeler 2003/07/09 00:42:23
Modified: src/java/org/apache/cocoon/servlet
ParanoidCocoonServlet.java CocoonServlet.java
. status.xml
src/scratchpad/src/org/apache/cocoon/generation
GarbageGenerator.java
src/java/org/apache/cocoon/components/treeprocessor/sitemap
PipelineNode.java
Log:
cocoon.xconf can be loaded from any location
ParanoidServlet can be configured optionally with a conf file
Revision Changes Path
1.5 +50 -2 cocoon-2.1/src/java/org/apache/cocoon/servlet/ParanoidCocoonServlet.java
Index: ParanoidCocoonServlet.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/servlet/ParanoidCocoonServlet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ParanoidCocoonServlet.java 2 Jul 2003 18:33:38 -0000 1.4
+++ ParanoidCocoonServlet.java 9 Jul 2003 07:42:22 -0000 1.5
@@ -51,8 +51,10 @@
package org.apache.cocoon.servlet;
import java.io.File;
+import java.io.FileReader;
import java.io.FilenameFilter;
import java.io.IOException;
+import java.io.LineNumberReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -96,7 +98,15 @@
super.init(config);
// Create the classloader in which we will load the servlet
- this.classloader = getClassLoader(this.getContextDir());
+ // this can either be specified by an external file configured
+ // as a parameter in web.xml or (the default) all jars and
+ // classes from WEB-INF/lib and WEB-INF/classes are used.
+ final String externalClasspath = config.getInitParameter("paranoid-classpath");
+ if ( externalClasspath == null ) {
+ this.classloader = this.getClassLoader(this.getContextDir());
+ } else {
+ this.classloader = this.getClassLoader(externalClasspath);
+ }
String servletName = config.getInitParameter("servlet-class");
if (servletName == null) {
@@ -190,6 +200,44 @@
return ParanoidClassLoader.newInstance(urls, this.getClass().getClassLoader());
}
+ /**
+ * Get the classloader that will be used to create the actual servlet. Its classpath is defined
+ * by an external file.
+ */
+ protected ClassLoader getClassLoader(String externalClasspath)
+ throws ServletException {
+ final List urlList = new ArrayList();
+
+ log("Adding classpath from " + externalClasspath);
+ try {
+ FileReader fileReader = new FileReader(externalClasspath);
+ LineNumberReader lineReader = new LineNumberReader(fileReader);
+
+ String line;
+ do {
+ line = lineReader.readLine();
+ if ( line != null ) {
+ final URL lib;
+ if ( line.indexOf(':') == -1) {
+ File entry = new File(line);
+ lib = entry.toURL();
+ } else {
+ lib = new URL(line);
+ }
+ log("Adding class library " + lib);
+ urlList.add(lib);
+ }
+ } while ( line != null );
+ lineReader.close();
+ } catch (IOException io) {
+ throw new ServletException(io);
+ }
+
+ URL[] urls = (URL[])urlList.toArray(new URL[urlList.size()]);
+
+ return ParanoidClassLoader.newInstance(urls, this.getClass().getClassLoader());
+ }
+
/**
* Service the request by delegating the call to the real servlet
*/
1.9 +7 -2 cocoon-2.1/src/java/org/apache/cocoon/servlet/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/servlet/CocoonServlet.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- CocoonServlet.java 3 Jun 2003 13:25:42 -0000 1.8
+++ CocoonServlet.java 9 Jul 2003 07:42:22 -0000 1.9
@@ -865,7 +865,12 @@
URL result;
try {
- result = this.servletContext.getResource(usedFileName);
+ // test if this is a qualified url
+ if ( usedFileName.indexOf(':') == -1) {
+ result = this.servletContext.getResource(usedFileName);
+ } else {
+ result = new URL(usedFileName);
+ }
} catch (Exception mue) {
String msg = "Init parameter 'configurations' is invalid : " + usedFileName;
log.error(msg, mue);
1.82 +7 -1 cocoon-2.1/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/status.xml,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- status.xml 6 Jul 2003 20:37:47 -0000 1.81
+++ status.xml 9 Jul 2003 07:42:23 -0000 1.82
@@ -183,6 +183,12 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="CZ" type="add">
+ ParanoidCocoonServlet can optionally configured with a file containing the classpath.
+ </action>
+ <action dev="CZ" type="add">
+ Configuration cocoon.xconf can now be read from any location.
+ </action>
<action dev="SW" type="fix">
Flow view can now be in "internal-only" pipelines.
</action>
1.5 +0 -1 cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/GarbageGenerator.java
Index: GarbageGenerator.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/GarbageGenerator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- GarbageGenerator.java 6 Jul 2003 23:27:24 -0000 1.4
+++ GarbageGenerator.java 9 Jul 2003 07:42:23 -0000 1.5
@@ -57,7 +57,6 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.flow.FlowHelper;
-import org.apache.cocoon.components.flow.WebContinuation;
import org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptFlowHelper;
import org.apache.cocoon.components.source.SourceUtil;
import org.apache.cocoon.environment.SourceResolver;
1.7 +1 -2 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
Index: PipelineNode.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PipelineNode.java 6 Jul 2003 20:37:47 -0000 1.6
+++ PipelineNode.java 9 Jul 2003 07:42:23 -0000 1.7
@@ -63,7 +63,6 @@
import org.apache.cocoon.components.treeprocessor.ParameterizableProcessingNode;
import org.apache.cocoon.components.treeprocessor.ProcessingNode;
import org.apache.cocoon.environment.Environment;
-import org.apache.cocoon.environment.ObjectModelHelper;
/**
* Handles <map:pipeline>