cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r160556 - in cocoon/trunk/src: java/org/apache/cocoon/components/pipeline/VirtualProcessingPipeline.java test/org/apache/cocoon/environment/mock/MockEnvironment.java
Date Fri, 08 Apr 2005 15:02:56 GMT
Author: danielf
Date: Fri Apr  8 08:02:54 2005
New Revision: 160556

URL: http://svn.apache.org/viewcvs?view=rev&rev=160556
Log:
The VirtualProcessingPipeline didn't connect serializers to output, so no output was generated,
fixed. Set MockEnvironment.isResponseModified to true to get any output. The VPC reader at
least works for my minimal test example.

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/VirtualProcessingPipeline.java
    cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/VirtualProcessingPipeline.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/VirtualProcessingPipeline.java?view=diff&r1=160555&r2=160556
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/VirtualProcessingPipeline.java
(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/VirtualProcessingPipeline.java
Fri Apr  8 08:02:54 2005
@@ -42,6 +42,7 @@
 import org.apache.excalibur.source.SourceValidity;
 import org.xml.sax.SAXException;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -400,7 +401,26 @@
     throws ProcessingException {
 
         try {
-            this.generator.generate();
+            if (this.lastConsumer == null) {
+                // internal processing
+                this.generator.generate();
+            } else {
+                if (this.serializer.shouldSetContentLength()) {
+                    // set the output stream
+                    ByteArrayOutputStream os = new ByteArrayOutputStream();
+                    this.serializer.setOutputStream(os);
+
+                    // execute the pipeline:
+                    this.generator.generate();
+                    environment.setContentLength(os.size());
+                    os.writeTo(environment.getOutputStream(0));
+                } else {
+                    // set the output stream
+                    this.serializer.setOutputStream(environment.getOutputStream(0));
+                    // execute the pipeline:
+                    this.generator.generate();
+                }
+            }
         } catch (ProcessingException e) {
             throw e;
         } catch (Exception e) {

Modified: cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java?view=diff&r1=160555&r2=160556
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java Fri Apr
 8 08:02:54 2005
@@ -107,7 +107,7 @@
     }
 
     public boolean isResponseModified(long lastModified) {
-        return false;
+        return true;
     }
 
     public void setResponseIsNotModified() {



Mime
View raw message