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 2005/05/31 19:37:24 UTC

svn commit: r179240 - /cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java /cocoon/trunk/src/java/org/apache/cocoon/util/BufferedOutputStream.java /cocoon/trunk/status.xml

Author: cziegeler
Date: Tue May 31 10:37:23 2005
New Revision: 179240

URL: http://svn.apache.org/viewcvs?rev=179240&view=rev
Log:
Set the content-length of a response when the pipeline buffers the content
(which is the default).

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
    cocoon/trunk/src/java/org/apache/cocoon/util/BufferedOutputStream.java
    cocoon/trunk/status.xml

Modified: cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java?rev=179240&r1=179239&r2=179240&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/AbstractEnvironment.java Tue May 31 10:37:23 2005
@@ -168,6 +168,7 @@
      * @see org.apache.cocoon.environment.Environment#setStatus(int)
      */
     public void setStatus(int statusCode) {
+        // for subclasses
     }
 
     /* (non-Javadoc)
@@ -255,6 +256,7 @@
     public void commitResponse()
     throws IOException {
         if (this.secureOutputStream != null) {
+            this.setContentLength(this.secureOutputStream.getCount());
             this.secureOutputStream.realFlush();
         } else if ( this.outputStream != null ){
             this.outputStream.flush();

Modified: cocoon/trunk/src/java/org/apache/cocoon/util/BufferedOutputStream.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/util/BufferedOutputStream.java?rev=179240&r1=179239&r2=179240&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/util/BufferedOutputStream.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/util/BufferedOutputStream.java Tue May 31 10:37:23 2005
@@ -25,7 +25,7 @@
  * the output stream.
  * 
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: BufferedOutputStream.java,v 1.4 2004/06/24 07:14:44 cziegeler Exp $
+ * @version CVS $Id$
  * @since   2.1
  */
 public final class BufferedOutputStream extends FilterOutputStream {
@@ -101,11 +101,12 @@
 
     /**
      * Flushes this buffered output stream. 
-     * We don't flush here. 
+     * We don't flush here, flushing is done during closing.
      *
      * @exception  IOException  if an I/O error occurs.
      */
     public void flush() throws IOException {
+        // nothing
     }
 
     /**
@@ -121,7 +122,6 @@
 
     /**
      * Flushes this buffered output stream. 
-     * We don't flush here. 
      */
     public void realFlush() throws IOException {
         this.writeBuffer();
@@ -135,6 +135,7 @@
     throws IOException {
         if (this.count > 0) {
             this.out.write(this.buf, 0, this.count);
+            this.clearBuffer();
         }
     }
 
@@ -155,6 +156,12 @@
     public void clearBuffer() {
         this.count = 0;
     }
-    
+
+    /**
+     * Return the size of the current buffer
+     */
+    public int getCount() {
+        return this.count;
+    }
 }
 

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?rev=179240&r1=179239&r2=179240&view=diff
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Tue May 31 10:37:23 2005
@@ -447,6 +447,10 @@
    </action>
   </release>
   <release version="2.1.8" date="TBD">
+    <action dev="CZ" type="update">
+      Set the content-length of a response when the pipeline buffers the content
+      (which is the default).
+    </action>
     <action dev="SW" type="fix">
       When receiving a multipart request, also add parameters given on the URL to the
       request parameters.