Examples of XOPEncodingStreamWriter


Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

            ContentIDGenerator contentIDGenerator = new ContentIDGenerator() {
                public String generateContentID(String existingContentID) {
                    return existingContentID != null ? existingContentID : getNextContentId();
                }
            };
            xmlWriter = new XOPEncodingStreamWriter(StAXUtils.createXMLStreamWriter(
                    format.getStAXWriterConfiguration(), rootPartOutputStream, encoding),
                    contentIDGenerator, optimizationPolicy);
        } else {
            xmlWriter = StAXUtils.createXMLStreamWriter(format.getStAXWriterConfiguration(),
                    outStream, format.getCharSetEncoding());
View Full Code Here

Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

            log.debug("The XML writing is completed.  Now the attachments are written");
            isComplete = true;
            try {
                rootPartOutputStream.close();
                // First write the attachments added properly through the DataHandlerWriter extension
                XOPEncodingStreamWriter encoder = (XOPEncodingStreamWriter)xmlWriter;
                for (Iterator it = encoder.getContentIDs().iterator(); it.hasNext(); ) {
                    String contentID = (String)it.next();
                    DataHandler dataHandler = encoder.getDataHandler(contentID);
                    if (preserveAttachments || !(dataHandler instanceof DataHandlerExt)) {
                        multipartWriter.writePart(dataHandler, contentID);
                    } else {
                        OutputStream out = multipartWriter.writePart(dataHandler.getContentType(), contentID);
                        BufferUtils.inputStream2OutputStream(((DataHandlerExt)dataHandler).readOnce(), out);
View Full Code Here

Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

   
    // START SNIPPET: variant1
    private void logMessage1(SOAPEnvelope env) throws XMLStreamException {
        StringWriter sw = new StringWriter();
        XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(sw);
        XMLStreamWriter encoder = new XOPEncodingStreamWriter(writer,
                ContentIDGenerator.DEFAULT, OptimizationPolicy.DEFAULT);
        env.serialize(encoder);
        log.info("Message: " + sw.toString());
    }
View Full Code Here

Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

            ContentIDGenerator contentIDGenerator = new ContentIDGenerator() {
                public String generateContentID(String existingContentID) {
                    return existingContentID != null ? existingContentID : getNextContentId();
                }
            };
            xmlWriter = new XOPEncodingStreamWriter(StAXUtils.createXMLStreamWriter(
                    format.getStAXWriterConfiguration(), rootPartOutputStream, encoding),
                    contentIDGenerator, optimizationPolicy);
        } else {
            xmlWriter = StAXUtils.createXMLStreamWriter(format.getStAXWriterConfiguration(),
                    outStream, format.getCharSetEncoding());
View Full Code Here

Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

            }
            isComplete = true;
            try {
                rootPartOutputStream.close();
                // First write the attachments added properly through the DataHandlerWriter extension
                XOPEncodingStreamWriter encoder = (XOPEncodingStreamWriter)xmlWriter;
                for (Iterator it = encoder.getContentIDs().iterator(); it.hasNext(); ) {
                    String contentID = (String)it.next();
                    multipartWriter.writePart(encoder.getDataHandler(contentID), contentID);
                }
                // This is for compatibility with writeOptimized
                for (Iterator it = binaryNodeList.iterator(); it.hasNext();) {
                    OMText text = (OMText) it.next();
                    multipartWriter.writePart((DataHandler) text.getDataHandler(),
View Full Code Here

Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

            ContentIDGenerator contentIDGenerator = new ContentIDGenerator() {
                public String generateContentID(String existingContentID) {
                    return existingContentID != null ? existingContentID : getNextContentId();
                }
            };
            xmlWriter = new XOPEncodingStreamWriter(StAXUtils.createXMLStreamWriter(
                    rootPartOutputStream, encoding), contentIDGenerator, optimizationPolicy);
        } else {
            xmlWriter = StAXUtils.createXMLStreamWriter(outStream,
                                                        format.getCharSetEncoding());
        }
View Full Code Here

Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

            }
            isComplete = true;
            try {
                rootPartOutputStream.close();
                // First write the attachments added properly through the DataHandlerWriter extension
                XOPEncodingStreamWriter encoder = (XOPEncodingStreamWriter)xmlWriter;
                for (Iterator it = encoder.getContentIDs().iterator(); it.hasNext(); ) {
                    String contentID = (String)it.next();
                    multipartWriter.writePart(encoder.getDataHandler(contentID), contentID);
                }
                // This is for compatibility with writeOptimized
                for (Iterator it = binaryNodeList.iterator(); it.hasNext();) {
                    OMText text = (OMText) it.next();
                    multipartWriter.writePart((DataHandler) text.getDataHandler(),
View Full Code Here

Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

            ContentIDGenerator contentIDGenerator = new ContentIDGenerator() {
                public String generateContentID(String existingContentID) {
                    return existingContentID != null ? existingContentID : getNextContentId();
                }
            };
            xmlWriter = new XOPEncodingStreamWriter(StAXUtils.createXMLStreamWriter(
                    format.getStAXWriterConfiguration(), rootPartOutputStream, encoding),
                    contentIDGenerator, optimizationPolicy);
        } else {
            xmlWriter = StAXUtils.createXMLStreamWriter(format.getStAXWriterConfiguration(),
                    outStream, format.getCharSetEncoding());
View Full Code Here

Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

            log.debug("The XML writing is completed.  Now the attachments are written");
            isComplete = true;
            try {
                rootPartOutputStream.close();
                // First write the attachments added properly through the DataHandlerWriter extension
                XOPEncodingStreamWriter encoder = (XOPEncodingStreamWriter)xmlWriter;
                for (Iterator it = encoder.getContentIDs().iterator(); it.hasNext(); ) {
                    String contentID = (String)it.next();
                    DataHandler dataHandler = encoder.getDataHandler(contentID);
                    if (preserveAttachments || !(dataHandler instanceof DataHandlerExt)) {
                        multipartWriter.writePart(dataHandler, contentID);
                    } else {
                        OutputStream out = multipartWriter.writePart(dataHandler.getContentType(), contentID);
                        BufferUtils.inputStream2OutputStream(((DataHandlerExt)dataHandler).readOnce(), out);
View Full Code Here

Examples of org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter

            ContentIDGenerator contentIDGenerator = new ContentIDGenerator() {
                public String generateContentID(String existingContentID) {
                    return existingContentID != null ? existingContentID : getNextContentId();
                }
            };
            xmlWriter = new XOPEncodingStreamWriter(StAXUtils.createXMLStreamWriter(
                    format.getStAXWriterConfiguration(), rootPartOutputStream, encoding),
                    contentIDGenerator, optimizationPolicy);
        } else {
            xmlWriter = StAXUtils.createXMLStreamWriter(format.getStAXWriterConfiguration(),
                    outStream, format.getCharSetEncoding());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.