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 2002/11/20 11:35:52 UTC
cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/source SitemapSource.java
cziegeler 2002/11/20 02:35:52
Modified: src/java/org/apache/cocoon/components/source
SitemapSource.java
Log:
Fixing bug 12293: RequestLifecycleComponents are not handled properly when the cocoon: protocol is used
Revision Changes Path
1.23 +26 -3 xml-cocoon2/src/java/org/apache/cocoon/components/source/SitemapSource.java
Index: SitemapSource.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/SitemapSource.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- SitemapSource.java 8 Aug 2002 02:10:39 -0000 1.22
+++ SitemapSource.java 20 Nov 2002 10:35:52 -0000 1.23
@@ -60,6 +60,8 @@
import org.apache.cocoon.Processor;
import org.apache.cocoon.components.CocoonComponentManager;
import org.apache.cocoon.components.pipeline.ProcessingPipeline;
+import org.apache.cocoon.components.sax.XMLDeserializer;
+import org.apache.cocoon.components.sax.XMLSerializer;
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.environment.ModifiableSource;
import org.apache.cocoon.environment.wrapper.EnvironmentWrapper;
@@ -112,7 +114,7 @@
/** The prefix for the processing */
private String prefix;
- /** The <code>StreamPipeline</code> */
+ /** The <code>ProcessingPipeline</code> */
private ProcessingPipeline processingPipeline;
/** The redirect <code>Source</code> */
@@ -124,6 +126,9 @@
/** Do I need a refresh ? */
private boolean needsRefresh;
+ /** The unique key for this processing */
+ private Object processKey;
+
/**
* Construct a new object
*/
@@ -270,6 +275,7 @@
public void refresh() {
reset();
try {
+ this.processKey = CocoonComponentManager.startProcessing(this.environment);
this.environment.setURI(this.prefix, this.uri);
this.processingPipeline = this.processor.processInternal(this.environment);
this.pipelineProcessor = this.environment.changeToLastContext();
@@ -326,14 +332,27 @@
if (this.redirectSource != null) {
this.environment.toSAX(this.redirectSource, consumer);
} else {
+ // We have to buffer the result in order to get
+ // clean environment stack handling.
+ XMLSerializer xmls = (XMLSerializer) this.manager.lookup(XMLSerializer.ROLE);
+ Object fragment;
try {
CocoonComponentManager.enterEnvironment(this.environment,
this.environment.getObjectModel(),
this.pipelineProcessor);
- this.processingPipeline.process(this.environment, consumer);
+ this.processingPipeline.process(this.environment, xmls);
+ fragment = xmls.getSAXFragment();
} finally {
+ this.manager.release(xmls);
CocoonComponentManager.leaveEnvironment();
}
+ XMLDeserializer xmld = (XMLDeserializer) this.manager.lookup(XMLDeserializer.ROLE);
+ try {
+ xmld.setConsumer(consumer);
+ xmld.deserialize(fragment);
+ } finally {
+ this.manager.release(xmld);
+ }
}
} catch (ProcessingException e) {
// Preserve original exception
@@ -348,6 +367,10 @@
private void reset() {
if (this.processingPipeline != null) this.processingPipeline.release();
+ if (this.processKey != null) {
+ CocoonComponentManager.endProcessing(this.processKey);
+ this.processKey = null;
+ }
this.processingPipeline = null;
this.lastModificationDate = 0;
this.environment.release(this.redirectSource);
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org