You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by co...@apache.org on 2004/01/14 07:39:55 UTC
cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/flow AbstractInterpreter.java
coliver 2004/01/13 22:39:55
Modified: src/java/org/apache/cocoon/components/flow
AbstractInterpreter.java
Log:
Changed forwardTo to invoke the sitemap processor directly rather than using a cocoon redirect: this ensures that pipeline processing is complete before forwardTo returns allowing the caller to release resources needed during pipeline processing
Revision Changes Path
1.12 +14 -17 cocoon-2.1/src/java/org/apache/cocoon/components/flow/AbstractInterpreter.java
Index: AbstractInterpreter.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/AbstractInterpreter.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AbstractInterpreter.java 20 Nov 2003 15:31:29 -0000 1.11
+++ AbstractInterpreter.java 14 Jan 2004 06:39:55 -0000 1.12
@@ -198,11 +198,11 @@
* @exception Exception If an error occurs.
*/
public boolean process(String uri, Object biz, OutputStream out, Environment env)
- throws Exception {
- if (out == null) {
- throw new NullPointerException("No outputstream specified for process");
+ throws Exception
+ {
+ if (SourceUtil.indexOfSchemeColon(uri) != -1) {
+ throw new Exception("uri is not allowed to contain a scheme (cocoon:/ is always automatically used)");
}
-
// if the uri starts with a slash, then assume that the uri contains an absolute
// path, starting from the root sitemap. Otherwise, the uri is relative to the current
// sitemap.
@@ -215,7 +215,9 @@
// Create a wrapper environment for the subrequest to be processed.
EnvironmentWrapper wrapper = new EnvironmentWrapper(env, uri, "", getLogger());
wrapper.setURI("", uri);
- wrapper.setOutputStream(out);
+ if (out != null) {
+ wrapper.setOutputStream(out);
+ }
Map objectModel = env.getObjectModel();
FlowHelper.setContextObject(objectModel, biz);
@@ -233,9 +235,10 @@
// Process the subrequest
result = processor.process(wrapper);
- wrapper.commitResponse();
- out.flush();
-
+ if (out != null) {
+ wrapper.commitResponse();
+ out.flush();
+ }
// Return whatever the processor returned us
return(result);
} catch (Exception any) {
@@ -255,16 +258,10 @@
public void forwardTo(String uri, Object bizData,
WebContinuation continuation,
Environment environment)
- throws Exception
+ throws Exception
{
- if (SourceUtil.indexOfSchemeColon(uri) != -1)
- throw new Exception("uri is not allowed to contain a scheme (cocoon:/ is always automatically used)");
-
- uri = "cocoon:/" + uri;
-
Map objectModel = environment.getObjectModel();
- FlowHelper.setContextObject(objectModel, bizData);
FlowHelper.setWebContinuation(objectModel, continuation);
- PipelinesNode.getRedirector(environment).redirect(false, uri);
+ process(uri, bizData, null, environment);
}
}