Author: veithen Date: Sun Oct 17 13:15:05 2010 New Revision: 1023497 URL: http://svn.apache.org/viewvc?rev=1023497&view=rev Log: WSCOMMONS-562: Added a property to OMOutputFormat that allows to set the StAXWriterConfiguration that will be used when MTOMXMLStreamWriter requests an XMLStreamWriter from StAXUtils.
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java?rev=1023497&r1=1023496&r2=1023497&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java Sun Oct 17 13:15:05 2010 @@ -22,6 +22,7 @@ package org.apache.axiom.om; import java.util.HashMap; import org.apache.axiom.om.impl.MTOMConstants; +import org.apache.axiom.om.util.StAXWriterConfiguration; import org.apache.axiom.om.util.XMLStreamWriterFilter; import org.apache.axiom.soap.SOAP11Constants; import org.apache.axiom.soap.SOAP12Constants; @@ -62,6 +63,8 @@ public class OMOutputFormat { private XMLStreamWriterFilter xmlStreamWriterFilter = null; + private StAXWriterConfiguration writerConfiguration; + // The value of this property is a Boolean. // A missing value indicates the default action, which is Boolean.FALSE // If Boolean.TRUE, attachments that are "non textual" are written out with @@ -404,4 +407,25 @@ public class OMOutputFormat { public void setXmlStreamWriterFilter(XMLStreamWriterFilter xmlStreamWriterFilter) { this.xmlStreamWriterFilter = xmlStreamWriterFilter; } + + /** + * Get the currently configured StAX writer configuration. + * + * @return the current configuration; {...@link StAXWriterConfiguration#DEFAULT} if none has been + * set explicitly + */ + public StAXWriterConfiguration getStAXWriterConfiguration() { + return writerConfiguration == null ? StAXWriterConfiguration.DEFAULT : writerConfiguration; + } + + /** + * Set the StAX writer configuration that will be used when requesting an + * {...@link javax.xml.stream.XMLStreamWriter} from {...@link org.apache.axiom.om.util.StAXUtils}. + * + * @param writerConfiguration + * the configuration + */ + public void setStAXWriterConfiguration(StAXWriterConfiguration writerConfiguration) { + this.writerConfiguration = writerConfiguration; + } } Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java?rev=1023497&r1=1023496&r2=1023497&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java Sun Oct 17 13:15:05 2010 @@ -122,10 +122,11 @@ public class MTOMXMLStreamWriter impleme } }; xmlWriter = new XOPEncodingStreamWriter(StAXUtils.createXMLStreamWriter( - rootPartOutputStream, encoding), contentIDGenerator, optimizationPolicy); + format.getStAXWriterConfiguration(), rootPartOutputStream, encoding), + contentIDGenerator, optimizationPolicy); } else { - xmlWriter = StAXUtils.createXMLStreamWriter(outStream, - format.getCharSetEncoding()); + xmlWriter = StAXUtils.createXMLStreamWriter(format.getStAXWriterConfiguration(), + outStream, format.getCharSetEncoding()); } xmlStreamWriterFilter = format.getXmlStreamWriterFilter(); if (xmlStreamWriterFilter != null) {