Package org.apache.ws.commons.attachments

Examples of org.apache.ws.commons.attachments.MIMEHelper


            attachmentSizeThreshold = (parameter == null)
                    ? ""
                    : parameter.getValue().toString();
        }

        MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString,
                fileCacheForAttachments, attachmentRepoDir,
                attachmentSizeThreshold);
        String charSetEncoding =
                getCharSetEncoding(mimeHelper.getSOAPPartContentType());
        XMLStreamReader streamReader;

        if ((charSetEncoding == null) || "null".equalsIgnoreCase(charSetEncoding)) {
            charSetEncoding = MessageContext.UTF_8;
        }

        try {
            streamReader = XMLInputFactory.newInstance().createXMLStreamReader(
                    getReader(mimeHelper.getSOAPPartInputStream(), charSetEncoding));
        } catch (IOException e) {
            throw new XMLStreamException(e);
        }

        msgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, charSetEncoding);

        /*
        * put a reference to Attachments in to the message context
        */
        msgContext.setProperty(MTOMConstants.ATTACHMENTS, mimeHelper);

        if (mimeHelper.getAttachmentSpecType().equals(MTOMConstants.MTOM_TYPE)) {

            /*
            * Creates the MTOM specific MTOMStAXSOAPModelBuilder
            */
            builder = new MTOMStAXSOAPModelBuilder(streamReader, mimeHelper, null);
        } else if (mimeHelper.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE)) {
            builder = new StAXSOAPModelBuilder(streamReader,
                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        }

        return builder;
View Full Code Here


    protected void setUp() throws Exception {
        super.setUp();
        inFileName = "mtom/MTOMBuilderTestIn.txt";
        InputStream inStream = new FileInputStream(getTestResourceFile(inFileName));
        mimeHelper = new MIMEHelper(inStream, contentTypeString);
        XMLStreamReader reader = XMLInputFactory.newInstance()
                .createXMLStreamReader(new BufferedReader(new InputStreamReader(mimeHelper
                .getSOAPPartInputStream())));
        builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.attachments.MIMEHelper

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.