cziegeler 2004/05/04 04:54:35
Modified: src/java/org/apache/cocoon/components/flow/util
PipelineUtil.java
src/java/org/apache/cocoon/components/treeprocessor
TreeProcessor.java
src/java/org/apache/cocoon/components/flow
AbstractInterpreter.java
src/blocks/javaflow/java/org/apache/cocoon/components/flow/java
AbstractContinuable.java
Log:
Make call to view from flow a forward again (and not a real redirect)
Revision Changes Path
1.3 +14 -2
cocoon-2.1/src/java/org/apache/cocoon/components/flow/util/PipelineUtil.java
Index: PipelineUtil.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/util/PipelineUtil.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PipelineUtil.java 5 Mar 2004 13:02:47 -0000 1.2
+++ PipelineUtil.java 4 May 2004 11:54:35 -0000 1.3
@@ -21,6 +21,7 @@
import java.util.Map;
import org.apache.avalon.excalibur.io.IOUtil;
+import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
@@ -45,12 +46,23 @@
* @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
* @version CVS $Id$
*/
-public class PipelineUtil implements Contextualizable, Serviceable {
+public class PipelineUtil implements Contextualizable, Serviceable,
Disposable {
private Context context;
private ServiceManager manager;
private SourceResolver resolver;
+ /* (non-Javadoc)
+ * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ */
+ public void dispose() {
+ if ( this.manager != null ) {
+ this.manager.release( this.resolver );
+ this.manager = null;
+ this.resolver = null;
+ }
+ }
+
public void contextualize(Context context) throws ContextException {
this.context = context;
1.25 +5 -2
cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
Index: TreeProcessor.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- TreeProcessor.java 18 Mar 2004 15:08:12 -0000 1.24
+++ TreeProcessor.java 4 May 2004 11:54:35 -0000 1.25
@@ -360,7 +360,10 @@
}
Environment newEnv = new ForwardEnvironmentWrapper(environment,
this.manager, uri, getLogger());
- ((ForwardEnvironmentWrapper)newEnv).setInternalRedirect(true);
+ // test if this is a call from flow
+ if ( environment.getObjectModel().remove("cocoon:forward") == null )
{
+ ((ForwardEnvironmentWrapper)newEnv).setInternalRedirect(true);
+ }
if (facade != null) {
// Change the facade delegate
1.20 +10 -4
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.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- AbstractInterpreter.java 5 Mar 2004 13:02:46 -0000 1.19
+++ AbstractInterpreter.java 4 May 2004 11:54:35 -0000 1.20
@@ -155,9 +155,13 @@
{
// FIXME (SW): should we deprecate this method in favor of
PipelineUtil?
PipelineUtil pipeUtil = new PipelineUtil();
- pipeUtil.contextualize(this.avalonContext);
- pipeUtil.service(this.manager);
- pipeUtil.processToStream(uri, biz, out);
+ try {
+ pipeUtil.contextualize(this.avalonContext);
+ pipeUtil.service(this.manager);
+ pipeUtil.processToStream(uri, biz, out);
+ } finally {
+ pipeUtil.dispose();
+ }
}
public void forwardTo(String uri, Object bizData,
@@ -173,6 +177,8 @@
if (redirector.hasRedirected()) {
throw new IllegalStateException("Pipeline has already been
processed for this request");
}
+ // this is a hint for the redirector
+ objectModel.put("cocoon:forward", "true");
redirector.redirect(false, uri);
} else {
throw new Exception("uri is not allowed to contain a scheme
(cocoon:/ is always automatically used)");
1.4 +5 -3
cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/AbstractContinuable.java
Index: AbstractContinuable.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/AbstractContinuable.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractContinuable.java 25 Apr 2004 12:12:08 -0000 1.3
+++ AbstractContinuable.java 4 May 2004 11:54:35 -0000 1.4
@@ -115,13 +115,15 @@
ContinuationContext context = getContext();
- try {
- PipelineUtil pipeUtil = new PipelineUtil();
+ PipelineUtil pipeUtil = new PipelineUtil();
+ try {
pipeUtil.contextualize(context.getAvalonContext());
pipeUtil.service(context.getServiceManager());
pipeUtil.processToStream(uri, bizdata, out);
} catch (Exception e) {
throw new CascadingRuntimeException("Cannot process pipeline to
'"+uri+"'", e);
+ } finally {
+ pipeUtil.dispose();
}
}