bloritsch 00/12/06 11:22:39
Modified: src/org/apache/cocoon Tag: xml-cocoon2 Constants.java
src/org/apache/cocoon/servlet Tag: xml-cocoon2
CocoonServlet.java
src/org/apache/cocoon/transformation Tag: xml-cocoon2
XTTransformer.java
Log:
Make the classpath attribute determinable at servlet init time. The
parameter is "classpath-attribute".
Please be certain to define this in your servlet init parameters.
Revision Changes Path
No revision
No revision
1.1.2.12 +40 -44 xml-cocoon/src/org/apache/cocoon/Attic/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Constants.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- Constants.java 2000/12/06 06:21:55 1.1.2.11
+++ Constants.java 2000/12/06 19:19:51 1.1.2.12
@@ -5,58 +5,54 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
-
+
package org.apache.cocoon;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/12/06 06:21:55 $
+ * @version CVS $Revision: 1.1.2.12 $ $Date: 2000/12/06 19:19:51 $
*/
public interface Constants {
+
+ String NAME = "@name@";
+ String VERSION = "@version@";
+ String COMPLETE_NAME = NAME + " " + VERSION;
+ String CONF_VERSION = "2.0";
+ String YEAR = "@year@";
+
+ String RELOAD_PARAM = "cocoon-reload";
+ String SHOWTIME_PARAM = "cocoon-showtime";
+ String VIEW_PARAM = "cocoon-view";
+
+ String TEMPDIR_PROPERTY = "org.apache.cocoon.properties.tempdir";
+ String DEFAULT_CONTEXT_DIR = "./webapp";
+ String DEFAULT_DEST_DIR = "./site";
+ String DEFAULT_WORK_DIR = "./work";
+ String DEFAULT_CONF_FILE = "cocoon.xconf";
+
+ String PARSER_PROPERTY = "org.apache.cocoon.components.parser.Parser";
+ String DEFAULT_PARSER =
"org.apache.cocoon.components.parser.XercesParser";
+
+ String XSP_PREFIX = "xsp";
+ String XSP_URI = "http://apache.org/xsp";
+ String XSP_REQUEST_PREFIX = "xsp-request";
+ String XSP_REQUEST_URI = XSP_URI + "/request";
+ String XSP_RESPONSE_PREFIX = "xsp-response";
+ String XSP_RESPONSE_URI = XSP_URI + "/response";
+
+ String LINK_CONTENT_TYPE = "application/x-cocoon-links";
+ String LINK_VIEW = "links";
+ String LINK_CRAWLING_ROLE = "static";
+
+ String REQUEST_OBJECT = "request";
+ String RESPONSE_OBJECT = "response";
+ String CONTEXT_OBJECT = "context";
+ String LINK_OBJECT = "link";
- public static final String NAME = "@name@";
- public static final String VERSION = "@version@";
- public static final String COMPLETE_NAME = NAME + " " + VERSION;
- public static final String CONF_VERSION = "2.0";
- public static final String YEAR = "@year@";
-
- public static final String RELOAD_PARAM = "cocoon-reload";
- public static final String SHOWTIME_PARAM = "cocoon-showtime";
- public static final String VIEW_PARAM = "cocoon-view";
-
- public static final String TEMPDIR_PROPERTY =
"org.apache.cocoon.properties.tempdir";
- public static final String DEFAULT_CONTEXT_DIR = "./webapp";
- public static final String DEFAULT_DEST_DIR = "./site";
- public static final String DEFAULT_WORK_DIR = "./work";
- public static final String DEFAULT_CONF_FILE = "cocoon.xconf";
-
- public static final String PARSER_PROPERTY =
"org.apache.cocoon.components.parser.Parser";
- public static final String DEFAULT_PARSER =
"org.apache.cocoon.components.parser.XercesParser";
-
- public static final String XSP_PREFIX = "xsp";
- public static final String XSP_URI = "http://apache.org/xsp";
- public static final String XSP_REQUEST_PREFIX = "xsp-request";
- public static final String XSP_REQUEST_URI = XSP_URI + "/request";
- public static final String XSP_RESPONSE_PREFIX = "xsp-response";
- public static final String XSP_RESPONSE_URI = XSP_URI + "/response";
-
- public static final String LINK_CONTENT_TYPE =
"application/x-cocoon-links";
- public static final String LINK_VIEW = "links";
- public static final String LINK_CRAWLING_ROLE = "static";
-
- public static final String REQUEST_OBJECT = "request";
- public static final String RESPONSE_OBJECT = "response";
- public static final String CONTEXT_OBJECT = "context";
- public static final String LINK_OBJECT = "link";
-
- public static final String INDEX_URI = "index";
-
- public static final String CATALINA_SERVLET_CLASSPATH =
"org.apache.catalina.jsp_classpath";
- public static final String TOMCAT_SERVLET_CLASSPATH =
"org.apache.tomcat.jsp_classpath";
- public static final String RESIN_SERVLET_CLASSPATH = "caucho.class.path";
+ String INDEX_URI = "index";
- public final static String ERROR_NAMESPACE_URI =
"http://apache.org/cocoon/" + CONF_VERSION + "/error";
- public final static String ERROR_NAMESPACE_PREFIX = "error";
+ String ERROR_NAMESPACE_URI = "http://apache.org/cocoon/" + CONF_VERSION
+ "/error";
+ String ERROR_NAMESPACE_PREFIX = "error";
}
No revision
No revision
1.1.4.35 +41 -27
xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
retrieving revision 1.1.4.34
retrieving revision 1.1.4.35
diff -u -r1.1.4.34 -r1.1.4.35
--- CocoonServlet.java 2000/12/06 06:21:56 1.1.4.34
+++ CocoonServlet.java 2000/12/06 19:19:58 1.1.4.35
@@ -51,7 +51,7 @@
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
- * @version CVS $Revision: 1.1.4.34 $ $Date: 2000/12/06 06:21:56 $
+ * @version CVS $Revision: 1.1.4.35 $ $Date: 2000/12/06 19:19:58 $
*/
public class CocoonServlet extends HttpServlet {
@@ -83,7 +83,7 @@
String path = this.context.getRealPath("/") +
"/WEB-INF/logs/cocoon.log";
- Category cocoonCategory = LogKit.createCategory("cocoon",
Priority.ERROR);
+ Category cocoonCategory = LogKit.createCategory("cocoon",
Priority.DEBUG);
log = LogKit.createLogger(cocoonCategory, new LogTarget[] {
new FileOutputLogTarget(path),
new ServletLogTarget(this.context, Priority.ERROR)
@@ -92,32 +92,46 @@
LogKit.log("Could not set up Cocoon Logger, will use screen
instead", e);
}
- LogKit.setGlobalPriority(Priority.ERROR);
+ LogKit.setGlobalPriority(Priority.DEBUG);
- // WARNING (SM): the line below BREAKS the Servlet API portability of
- // web applications.
- // This is a hack to go around java compiler design problems that
- // do not allow applications to force their own classloader to the
- // compiler during compilation.
- // We look for a specific Tomcat attribute so we are bound to Tomcat
- // this means Cocoon won't be able to compile things if the necessary
- // classes are not already present in the *SYSTEM* classpath, any
other
- // container classloading will break it on other servlet containers.
- // To fix this, Javac must be redesigned and rewritten or we have to
- // write our own compiler.
- // So, for now, the cocoon.war file with included libraries can work
- // only in Tomcat or in containers that simulate this context
attribute
- // (I don't know if any do) or, for other servlet containers, you
have
- // to extract all the libraries and place them in the system
classpath
- // or the compilation of sitemaps and XSP will fail.
- // I know this sucks, but I don't have the energy to write a java
- // compiler to fix this :(
- this.classpath = (String)
context.getAttribute(Cocoon.CATALINA_SERVLET_CLASSPATH);
- if (this.classpath == null) {
- this.classpath = (String)
context.getAttribute(Cocoon.TOMCAT_SERVLET_CLASSPATH);
- }
- if (this.classpath == null) {
- this.classpath = (String)
context.getAttribute(Cocoon.RESIN_SERVLET_CLASSPATH);
+ /* WARNING (SM): the lines below BREAKS the Servlet API portability
of
+ * web applications.
+ *
+ * This is a hack to go around java compiler design problems that
+ * do not allow applications to force their own classloader to the
+ * compiler during compilation.
+ *
+ * We look for a specific Tomcat attribute so we are bound to Tomcat
+ * this means Cocoon won't be able to compile things if the necessary
+ * classes are not already present in the *SYSTEM* classpath, any
other
+ * container classloading will break it on other servlet containers.
+ * To fix this, Javac must be redesigned and rewritten or we have to
+ * write our own compiler.
+ *
+ * So, for now, the cocoon.war file with included libraries can work
+ * only in Tomcat or in containers that simulate this context
attribute
+ * (I don't know if any do) or, for other servlet containers, you
have
+ * to extract all the libraries and place them in the system
classpath
+ * or the compilation of sitemaps and XSP will fail.
+ * I know this sucks, but I don't have the energy to write a java
+ * compiler to fix this :(
+ *
+ * This solution is to allow you to specify the servlet ClassPath
+ * attribute so that Cocoon can use it. If your files are in the
+ * system classpath, then we are still ok. For these popular
+ * servlet containers, we will provide you with the attribute name:
+ *
+ * Catalina (Tomcat 4.x) = "org.apache.catalina.jsp_classpath"
+ * Tomcat (3.x) = "org.apache.tomcat.jsp_classpath"
+ * Resin = "caucho.class.path"
+ * WebSphere (3.5 sp2) =
"com.ibm.websphere.servlet.application.classpath"
+ *
+ * For other servlet containers, please consult your manuals or
+ * put Cocoon in the System Classpath.
+ */
+ String servletClassPath =
conf.getInitParameter("classpath-attribute");
+ if (servletClassPath != null) {
+ this.classpath = (String) context.getAttribute(servletClassPath);
}
this.workDir = ((File)
this.context.getAttribute("javax.servlet.context.tempdir")).toString();
No revision
No revision
1.1.2.7 +5 -5
xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java
Index: XTTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- XTTransformer.java 2000/11/30 21:42:33 1.1.2.6
+++ XTTransformer.java 2000/12/06 19:21:03 1.1.2.7
@@ -67,7 +67,7 @@
* This Transformer use the XT processor.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sahuc Sebastien</a>
- * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/11/30 21:42:33 $
+ * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/12/06 19:21:03 $
*/
public class XTTransformer extends DocumentHandlerWrapper
implements Transformer, Composer {
@@ -87,11 +87,11 @@
*/
public void compose(ComponentManager manager) {
try {
- log.debug("Looking up " + Roles.STORE);
+ log.debug("Looking up " + Roles.STORE);
this.store = (Store) manager.lookup(Roles.STORE);
- } catch (Exception e) {
- log.error("Could not find component", e);
- }
+ } catch (Exception e) {
+ log.error("Could not find component", e);
+ }
}
/**