Author: klape
Date: 2012-02-24 09:42:27 -0500 (Fri, 24 Feb 2012)
New Revision: 15737
Modified:
common/branches/jbossws-common-1.1.0.SP8_JBPAPP-8226/src/main/java/org/jboss/ws/Constants.java
common/branches/jbossws-common-1.1.0.SP8_JBPAPP-8226/src/main/java/org/jboss/wsf/common/DOMWriter.java
Log:
[JBPAPP-8226] DOMWriter shouldn't flush the output stream after every element
Modified:
common/branches/jbossws-common-1.1.0.SP8_JBPAPP-8226/src/main/java/org/jboss/ws/Constants.java
===================================================================
---
common/branches/jbossws-common-1.1.0.SP8_JBPAPP-8226/src/main/java/org/jboss/ws/Constants.java 2012-02-24
14:41:08 UTC (rev 15736)
+++
common/branches/jbossws-common-1.1.0.SP8_JBPAPP-8226/src/main/java/org/jboss/ws/Constants.java 2012-02-24
14:42:27 UTC (rev 15737)
@@ -304,4 +304,6 @@
static final String DOM_CONTENT_CANONICAL_NORMALIZATION =
"org.jboss.ws.DOMContentCanonicalNormalization";
static final String ALWAYS_RESOLVE_DOCUMENT_BUILDER_FACTORY =
"org.jboss.ws.alwaysResolveDocumentBuilderFactory";
+
+ static final String FLUSH_ONLY_ONCE =
"org.jboss.ws.domwriter.FlushOnlyOnce";
}
Modified:
common/branches/jbossws-common-1.1.0.SP8_JBPAPP-8226/src/main/java/org/jboss/wsf/common/DOMWriter.java
===================================================================
---
common/branches/jbossws-common-1.1.0.SP8_JBPAPP-8226/src/main/java/org/jboss/wsf/common/DOMWriter.java 2012-02-24
14:41:08 UTC (rev 15736)
+++
common/branches/jbossws-common-1.1.0.SP8_JBPAPP-8226/src/main/java/org/jboss/wsf/common/DOMWriter.java 2012-02-24
14:42:27 UTC (rev 15737)
@@ -71,6 +71,8 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.jboss.ws.Constants;
+
/**
* Traverse a DOM tree in order to print a document that is parsed.
*
@@ -102,7 +104,15 @@
private boolean completeNamespaces = true;
// The current default namespace
private String currentDefaultNamespace;
+ // How often should we flush the output stream?
+ private static final boolean flushOnlyOnce;
+ static
+ {
+ flushOnlyOnce = System.getProperty(Constants.FLUSH_ONLY_ONCE, "false")
+ .equals("true");
+ }
+
public DOMWriter(Writer w)
{
this.out = new PrintWriter(w);
@@ -231,6 +241,8 @@
rootNode = node;
printInternal(node, false);
+ if(flushOnlyOnce)
+ out.flush();
}
private void printInternal(Node node, boolean indentEndMarker)
@@ -510,7 +522,9 @@
out.print('\n');
}
}
- out.flush();
+
+ if(!flushOnlyOnce)
+ out.flush();
}
private String getNamespaceURI(String prefix, Element element, Node stopNode)
Show replies by date