Hi all,
the outputBufferSize as a pipeline parameter doesn't help to push the output
early to the client
(at least if the document is a small document <16k).
The reason is a BufferedOutputStream which is setup in the serializer
org.apache.xml.serializer.WriterToUTF8Buffered.java (2.7.0)
/** number of bytes that the byte buffer can hold.
* This is a fixed constant is used rather than m_outputBytes.lenght for
performance.
*/
private static final int BYTES_MAX=16*1024;
That buffer already was existing in xalan2.5.1 but there a directWrite
wrote out every byte with write(int);
Now the serializer writes out if the buffer is full or at end of document with
write(byte[], int, int).
That means setting the outputBufferSize in sitemap to lower than 16*1024 is
senseless
and the comment in org.apache.cocoon.environment.AbstractEnvironment.java
// FIXME Triple buffering, anyone?
is correct: It makes no sense to buffer here. A value of 0 has the same effect as
a value <= 16*1024.
(In detail the serializer buffer is for serialized bytes, in sitemap it is for
pipeline bytes
which probably is different depending on the stylesheet. I did not investigate
how performance
differs for outputBufferSize=0 or >0)
I use a real time application which has to write html immediately, independent
of the number of bytes.
I use the following (and a Cocoon committer should propose that as a patch to
the xalan team):
I add an attribute flush="on" to my xml stream. From now on xalan flushes at
every endElement().
If I want to stop that I add an attribute flush="off" to my xml stream.
--- xalan-j_2_7_0.orig/src/org/apache/xml/serializer/ToHTMLStream.java
2005-08-06 23:05:30.000000000 +0200
+++ xalan-j_2_7_0/src/org/apache/xml/serializer/ToHTMLStream.java
2007-03-27 10:48:24.860050168 +0200
@@ -749,6 +749,7 @@
* @see #endElement
* @see org.xml.sax.AttributeList
*/
+ boolean flushAll = false;
public void startElement(
String namespaceURI,
String localName,
@@ -756,6 +757,15 @@
Attributes atts)
throws org.xml.sax.SAXException
{
+ if(atts != null)
+ {
+ String flushAtt = atts.getValue("flush");
+ if(flushAtt != null)
+ {
+ if(flushAtt.equals("on")) flushAll = true;
+ else if(flushAtt.equals("off")) flushAll = false;
+ }
+ }
ElemContext elemContext = m_elemContext;
@@ -887,6 +897,7 @@
final String name)
throws org.xml.sax.SAXException
{
+ if(flushAll) flushWriter();
// deal with any pending issues
if (m_cdataTagOpen)
closeCDATA();
The same has to applied to ToStream.java.
I hope that others find it useful too.
Regards,
Michael
--
WINCOR NIXDORF International GmbH
Retail Store Solutions
Wernerwerkdamm 16
13629 Berlin, Germany
Phone +49 (0) 30 5017-1386
Fax +49 (0) 30 5017-1305
E-Mail [EMAIL PROTECTED]
WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: 33106 Paderborn, Heinz-Nixdorf-Ring 1
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Jürgen Wilde,
Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0031
Ust-ID Nr.: DE812927716
WEEE-Reg.-Nr. DE44477193
Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der richtige
Adressat sind oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht
gestattet.
This e-mail may contain confidential information. If you are not the intended
recipient or
have received this e-mail in error, please notify the sender immediately and
destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.