Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 15078 invoked by uid 500); 20 Nov 2002 10:36:00 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 15006 invoked by uid 500); 20 Nov 2002 10:35:58 -0000 Delivered-To: apmail-xml-cocoon2-cvs@apache.org Date: 20 Nov 2002 10:35:52 -0000 Message-ID: <20021120103552.42323.qmail@icarus.apache.org> From: cziegeler@apache.org To: xml-cocoon2-cvs@apache.org Subject: cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/source SitemapSource.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 StreamPipeline */ + /** The ProcessingPipeline */ private ProcessingPipeline processingPipeline; /** The redirect Source */ @@ -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