cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andr...@apache.org
Subject svn commit: r1078797 - /cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/EncodingSerializer.java
Date Mon, 07 Mar 2011 14:54:48 GMT
Author: andreas
Date: Mon Mar  7 14:54:48 2011
New Revision: 1078797

URL: http://svn.apache.org/viewvc?rev=1078797&view=rev
Log:
Make EncodingSerializer.shouldSetContentLength() configurable.

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/EncodingSerializer.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/EncodingSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/EncodingSerializer.java?rev=1078797&r1=1078796&r2=1078797&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/EncodingSerializer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/serializers/java/org/apache/cocoon/components/serializers/EncodingSerializer.java
Mon Mar  7 14:54:48 2011
@@ -46,6 +46,7 @@ import org.xml.sax.SAXException;
  * <serializer class="org.apache.cocoon.components.serializers..." ... >
  *   <encoding>myencoding</encoding>
  *   <indent>myindenting</indent>
+ *   <setContentLength>false</setContentLength>
  * </serializer>
  * </pre>
  * 
@@ -56,6 +57,10 @@ import org.xml.sax.SAXException;
  * 
  * <p>The value indicated by <i>myindenting</i> will control the indenting
  * level for each element.<p>
+ * 
+ * <p>The value indicated by <em>setContentLength</em> determines if the
serializer
+ * sets the <code>Content-Length</code> HTTP header. The parameter is optional,
the
+ * default value is <em>false</em>.
  *
  * @version CVS $Id$
  */
@@ -116,6 +121,9 @@ public abstract class EncodingSerializer
     protected int indentPerLevel = 0;
     /* ====================================================================== */
 
+    /** Determine if the serializer should set the Content-Length HTTP header. */
+    private boolean setContentLength;
+
     /**
      * Create a new instance of this <code>EncodingSerializer</code>
      */
@@ -131,7 +139,7 @@ public abstract class EncodingSerializer
      * Test if the component wants to set the content length.
      */
     public boolean shouldSetContentLength() {
-        return(false);
+        return this.setContentLength;
     }
 
     /**
@@ -175,6 +183,8 @@ public abstract class EncodingSerializer
         if (indentPerLevel > 0) {
             assureIndentBuffer(indentPerLevel * 6);
         }
+        
+        this.setContentLength = conf.getChild("setContentLength").getValueAsBoolean(false);
     }
 
     /* ====================================================================== */



Mime
View raw message