Package org.apache.axiom.om.impl.builder

Examples of org.apache.axiom.om.impl.builder.XOPAwareStAXOMBuilder


                if (log.isDebugEnabled()) {
                    log.debug("  read optimized xop:include");
                }
                ((OMXMLStreamReader)xmlStreamReader).setInlineMTOM(false);
            }
            newBuilder = new XOPAwareStAXOMBuilder(xmlStreamReader, attachments);
        } else {
            newBuilder = new StAXOMBuilder(xmlStreamReader);
        }
        if (log.isDebugEnabled()) {
            log.debug("  newBuilder = " + newBuilder);
View Full Code Here


        return new SAXOMBuilder(omFactory, source, expandEntityReferences);
    }

    public OMXMLParserWrapper createOMBuilder(StAXParserConfiguration configuration,
            OMFactory omFactory, InputSource rootPart, MimePartProvider mimePartProvider) {
        XOPAwareStAXOMBuilder builder = new XOPAwareStAXOMBuilder(omFactory, createXMLStreamReader(
                configuration, rootPart), mimePartProvider);
        builder.releaseParserOnClose(true);
        return builder;
    }
View Full Code Here

        }
        // To handle REST XOP case
        else {
            if (attachments.getAttachmentSpecType().equals(MTOMConstants.MTOM_TYPE)) {
                builder = new XOPAwareStAXOMBuilder(streamReader, attachments);

            } else if (attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE)) {
                builder = new StAXOMBuilder(streamReader);
            } else if (attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE_12)) {
                builder = new StAXOMBuilder(streamReader);
View Full Code Here

        }
        // To handle REST XOP case
        else {
            if (attachments.getAttachmentSpecType().equals(
                    MTOMConstants.MTOM_TYPE)) {
                XOPAwareStAXOMBuilder stAXOMBuilder = new XOPAwareStAXOMBuilder(
                        streamReader, attachments);
                builder = stAXOMBuilder;

            } else if (attachments.getAttachmentSpecType().equals(
                    MTOMConstants.SWA_TYPE)) {
View Full Code Here

       
        // Write out the message
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(baos, oof);
       
        XOPAwareStAXOMBuilder builder =
            new XOPAwareStAXOMBuilder(attachments.getSOAPPartInputStream(),
                                      attachments);
        OMElement om = builder.getDocumentElement();
        om.serialize(writer);
        om.close(false);
        String outNormal = baos.toString();
       
        assertTrue(outNormal.indexOf("base64") == -1);
       
        // Now do it again but use base64 content-type-encoding for
        // binary attachments
        baos = new ByteArrayOutputStream();
        oof.setProperty(OMOutputFormat.USE_CTE_BASE64_FOR_NON_TEXTUAL_ATTACHMENTS,
                        Boolean.TRUE);
        writer = new MTOMXMLStreamWriter(baos, oof);
        builder =
            new XOPAwareStAXOMBuilder(attachments.getSOAPPartInputStream(),
                                      attachments);
        om = builder.getDocumentElement();
        om.serialize(writer);
        om.close(false);
        String outBase64 = baos.toString();
       
       
        // Do a quick check to see if the data is base64 and is
        // writing base64 compliant code.
        assertTrue(outBase64.indexOf("base64") != -1);
        assertTrue(outBase64.indexOf("GBgcGBQgHBwcJCQgKDBQNDAsL") != -1);
       
        // Now read the data back in
        InputStream is = new ByteArrayInputStream(outBase64.getBytes());
        Attachments attachments2 = new Attachments(is, TestConstants.MTOM_MESSAGE_CONTENT_TYPE);
       
        // Now write it back out with binary...
        baos = new ByteArrayOutputStream();
        oof.setProperty(OMOutputFormat.USE_CTE_BASE64_FOR_NON_TEXTUAL_ATTACHMENTS,
                        Boolean.FALSE);
        writer = new MTOMXMLStreamWriter(baos, oof);
        builder =
            new XOPAwareStAXOMBuilder(attachments2.getSOAPPartInputStream(),
                                      attachments2);
        om = builder.getDocumentElement();
        om.serialize(writer);
        om.close(false);
        String outBase64ToNormal = baos.toString();
       
        assertTrue(outBase64ToNormal.indexOf("base64") == -1);
       
        // Now do it again but use base64 content-type-encoding for
        // binary attachments
        baos = new ByteArrayOutputStream();
        oof.setProperty(OMOutputFormat.USE_CTE_BASE64_FOR_NON_TEXTUAL_ATTACHMENTS,
                        Boolean.TRUE);
        writer = new MTOMXMLStreamWriter(baos, oof);
        builder =
            new XOPAwareStAXOMBuilder(attachments2.getSOAPPartInputStream(),
                                      attachments2);
        om = builder.getDocumentElement();
        om.serialize(writer);
        om.close(false);
        String outBase64ToBase64 = baos.toString();
       
        // Do a quick check to see if the data is base64 and is
View Full Code Here

                if (log.isDebugEnabled()) {
                    log.debug("  read optimized xop:include");
                }
                ((OMXMLStreamReader)xmlStreamReader).setInlineMTOM(false);
            }
            newBuilder = new XOPAwareStAXOMBuilder(xmlStreamReader, attachments);
        } else {
            newBuilder = new StAXOMBuilder(xmlStreamReader);
        }
        if (log.isDebugEnabled()) {
            log.debug("  newBuilder = " + newBuilder);
View Full Code Here

    }
    // To handle REST XOP case
    else {
      if (attachments.getAttachmentSpecType().equals(
          MTOMConstants.MTOM_TYPE)) {
        XOPAwareStAXOMBuilder stAXOMBuilder = new XOPAwareStAXOMBuilder(
            streamReader, attachments);
        builder = stAXOMBuilder;

      } else if (attachments.getAttachmentSpecType().equals(
          MTOMConstants.SWA_TYPE)) {
View Full Code Here

        }
        // To handle REST XOP case
        else {
            if (attachments.getAttachmentSpecType().equals(
                    MTOMConstants.MTOM_TYPE)) {
                XOPAwareStAXOMBuilder stAXOMBuilder = new XOPAwareStAXOMBuilder(
                        streamReader, attachments);
                builder = stAXOMBuilder;

            } else if (attachments.getAttachmentSpecType().equals(
                    MTOMConstants.SWA_TYPE)) {
View Full Code Here

        }
        // To handle REST XOP case
        else {
            if (attachments.getAttachmentSpecType().equals(MTOMConstants.MTOM_TYPE)) {
                builder = new XOPAwareStAXOMBuilder(streamReader, attachments);

            } else if (attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE)) {
                builder = new StAXOMBuilder(streamReader);
            } else if (attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE_12)) {
                builder = new StAXOMBuilder(streamReader);
View Full Code Here

        }
        // To handle REST XOP case
        else {
            if (attachments.getAttachmentSpecType().equals(MTOMConstants.MTOM_TYPE)) {
                builder = new XOPAwareStAXOMBuilder(streamReader, attachments);

            } else if (attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE)) {
                builder = new StAXOMBuilder(streamReader);
            } else if (attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE_12)) {
                builder = new StAXOMBuilder(streamReader);
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.impl.builder.XOPAwareStAXOMBuilder

Copyright © 2018 www.massapicom. 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.