John,

"Morrison, John" wrote:
> 
> OK.  That makes sense.  Could you please regenerate the patch against the
> 20_branch and the head and I'll commit it?

thanks, here's the patch. You can apply it to both the head and the branch -
they're identical.

Joerg Henne
? serialization/.nbattrs
Index: serialization/AbstractSerializer.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/serialization/AbstractSerializer.java,v
retrieving revision 1.6
diff -u -r1.6 AbstractSerializer.java
--- serialization/AbstractSerializer.java       2001/10/11 07:28:23     1.6
+++ serialization/AbstractSerializer.java       2001/10/31 14:25:19
@@ -11,7 +11,6 @@
 import org.apache.avalon.excalibur.pool.Recyclable;
 import org.apache.cocoon.xml.AbstractXMLPipe;
 
-import java.io.BufferedOutputStream;
 import java.io.OutputStream;
 
 /**
@@ -32,7 +31,7 @@
      * Set the <code>OutputStream</code> where the XML should be serialized.
      */
     public void setOutputStream(OutputStream out) {
-        this.output = new BufferedOutputStream(out);
+        this.output = out;
     }
 
     /**
Index: serialization/AbstractTextSerializer.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/serialization/AbstractTextSerializer.java,v
retrieving revision 1.8
diff -u -r1.8 AbstractTextSerializer.java
--- serialization/AbstractTextSerializer.java   2001/10/11 07:28:23     1.8
+++ serialization/AbstractTextSerializer.java   2001/10/31 14:25:20
@@ -24,7 +24,13 @@
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.sax.SAXTransformerFactory;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Properties;
+import java.io.OutputStream;
+import java.io.BufferedOutputStream;
 
 /**
  * @author <a href="mailto:[EMAIL PROTECTED]";>Pierpaolo Fumagalli</a>
@@ -68,6 +74,16 @@
     private boolean hasMappings = false;
 
     /**
+     * The default output buffer size.
+     */
+    private static final int DEFAULT_BUFFER_SIZE = 8192;
+    
+    /**
+     * The output buffer size to use.
+     */
+    private int outputBufferSize = DEFAULT_BUFFER_SIZE;
+    
+    /**
      * Helper for TransformerFactory.
      */
     protected SAXTransformerFactory getTransformerFactory()
@@ -80,11 +96,31 @@
     }
 
     /**
+     * Set the <code>OutputStream</code> where the XML should be serialized.
+     */
+    public void setOutputStream(OutputStream out) {
+        /*
+         * Add a level of buffering to the output stream. Xalan serializes
+         * every character individually. In conjunction with chunked
+         * transfer encoding this would otherwise lead to a whopping 6-fold
+         * increase of data on the wire.
+         */
+        BufferedOutputStream streamBuffer = new BufferedOutputStream(out, 
+outputBufferSize);
+        super.setOutputStream(streamBuffer);
+    }
+
+    /**
      * Set the configurations for this serializer.
      */
     public void configure(Configuration conf)
       throws ConfigurationException {
 
+        // configure buffer size
+        Configuration bsc = conf.getChild("buffer-size", false);
+        if(null != bsc)
+          outputBufferSize = conf.getValueAsInteger(DEFAULT_BUFFER_SIZE);
+        
+        // configure xalan
         Configuration cdataSectionElements = conf.getChild("cdata-section-elements");
         Configuration dtPublic = conf.getChild("doctype-public");
         Configuration dtSystem = conf.getChild("doctype-system");
Index: serialization/HTMLSerializer.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/serialization/HTMLSerializer.java,v
retrieving revision 1.4
diff -u -r1.4 HTMLSerializer.java
--- serialization/HTMLSerializer.java   2001/10/11 07:28:23     1.4
+++ serialization/HTMLSerializer.java   2001/10/31 14:25:20
@@ -32,7 +32,7 @@
             super.setOutputStream(out);
             handler = getTransformerFactory().newTransformerHandler();
             format.put(OutputKeys.METHOD,"html");
-            handler.setResult(new StreamResult(out));
+            handler.setResult(new StreamResult(this.output));
             handler.getTransformer().setOutputProperties(format);
             this.setContentHandler(handler);
             this.setLexicalHandler(handler);
Index: serialization/TextSerializer.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/serialization/TextSerializer.java,v
retrieving revision 1.4
diff -u -r1.4 TextSerializer.java
--- serialization/TextSerializer.java   2001/10/11 07:28:23     1.4
+++ serialization/TextSerializer.java   2001/10/31 14:25:20
@@ -32,7 +32,7 @@
             super.setOutputStream(out);
             handler = getTransformerFactory().newTransformerHandler();
             format.put(OutputKeys.METHOD,"text");
-            handler.setResult(new StreamResult(out));
+            handler.setResult(new StreamResult(this.output));
             handler.getTransformer().setOutputProperties(format);
             this.setContentHandler(handler);
             this.setLexicalHandler(handler);
Index: serialization/XMLSerializer.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/serialization/XMLSerializer.java,v
retrieving revision 1.4
diff -u -r1.4 XMLSerializer.java
--- serialization/XMLSerializer.java    2001/10/11 07:28:23     1.4
+++ serialization/XMLSerializer.java    2001/10/31 14:25:20
@@ -32,7 +32,7 @@
             super.setOutputStream(out);
             this.handler = getTransformerFactory().newTransformerHandler();
             format.put(OutputKeys.METHOD,"xml");
-            handler.setResult(new StreamResult(out));
+            handler.setResult(new StreamResult(this.output));
             handler.getTransformer().setOutputProperties(format);
             this.setContentHandler(handler);
             this.setLexicalHandler(handler);

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to