Examples of MIMEHelper


Examples of org.apache.axis2.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

Examples of org.apache.axis2.attachments.MIMEHelper

    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

Examples of org.apache.axis2.attachments.MIMEHelper

    public OMElement echoAttachment(OMElement omEle) {
        OMElement child  = (OMElement)omEle.getFirstChild();
        OMAttribute attr = child.getFirstAttribute(new QName("href"));
        String contentID = attr.getValue();
        MIMEHelper attachment = (MIMEHelper)msgcts.getProperty(MTOMConstants.ATTACHMENTS);
        contentID = contentID.trim();

        if (contentID.substring(0, 3).equalsIgnoreCase("cid")) {
            contentID = contentID.substring(4);
        }
        DataHandler dataHandler = attachment.getDataHandler(contentID);
        OMText textNode = new OMTextImpl(dataHandler);
        omEle.build();
        child.detach();
        omEle.addChild(textNode);
        return omEle;
View Full Code Here

Examples of org.apache.axis2.attachments.MIMEHelper

            parameter = msgContext
                    .getParameter(Constants.Configuration.FILE_SIZE_THRESHOLD);
            attachmentSizeThreshold = parameter==null?"":parameter.getValue().toString();
        }

        MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString,
                fileCacheForAttachments, attachmentRepoDir,attachmentSizeThreshold);

        String charSetEncoding = getCharSetEncoding(mimeHelper.getSOAPPartContentType());
        XMLStreamReader reader;
        if(charSetEncoding == null || "null".equalsIgnoreCase(charSetEncoding)){
             reader = XMLInputFactory.newInstance()
                .createXMLStreamReader(
                        new BufferedReader(new InputStreamReader(mimeHelper
                                .getSOAPPartInputStream(),
                                charSetEncoding)));
            msgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, charSetEncoding);

        }else {
            reader = XMLInputFactory.newInstance()
                .createXMLStreamReader(
                        new BufferedReader(new InputStreamReader(mimeHelper
                                .getSOAPPartInputStream())));
            msgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, MessageContext.UTF_8);

        }


        /*
     * 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(
                    reader,
                    mimeHelper,
                    null);
        } else if (
            mimeHelper.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE)) {
            builder =
                new StAXSOAPModelBuilder(
                    reader,
                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        }
View Full Code Here

Examples of org.apache.axis2.attachments.MIMEHelper

            parameter = msgContext
                    .getParameter(Constants.Configuration.FILE_SIZE_THRESHOLD);
            attachmentSizeThreshold = parameter==null?"":parameter.getValue().toString();
        }

        MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString,
                fileCacheForAttachments, attachmentRepoDir,attachmentSizeThreshold);

        String charSetEncoding = getCharSetEncoding(mimeHelper.getSOAPPartContentType());
        XMLStreamReader reader;
        if(charSetEncoding == null || "null".equalsIgnoreCase(charSetEncoding)){
             reader = XMLInputFactory.newInstance()
                .createXMLStreamReader(
                        new BufferedReader(new InputStreamReader(mimeHelper
                                .getSOAPPartInputStream(),
                                charSetEncoding)));
            msgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, charSetEncoding);

        }else {
            reader = XMLInputFactory.newInstance()
                .createXMLStreamReader(
                        new BufferedReader(new InputStreamReader(mimeHelper
                                .getSOAPPartInputStream())));
            msgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, MessageContext.UTF_8);

        }


        /*
     * 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(
                    reader,
                    mimeHelper,
                    null);
        } else if (
            mimeHelper.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE)) {
            builder =
                new StAXSOAPModelBuilder(
                    reader,
                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        }
View Full Code Here

Examples of org.apache.axis2.attachments.MIMEHelper

    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

Examples of org.apache.axis2.attachments.MIMEHelper

    public OMElement echoAttachment(OMElement omEle) {
        OMElement child  = (OMElement)omEle.getFirstOMChild();
        OMAttribute attr = child.getFirstAttribute(new QName("href"));
        String contentID = attr.getAttributeValue();
        MIMEHelper attachment = (MIMEHelper)msgcts.getProperty(MTOMConstants.ATTACHMENTS);
        contentID = contentID.trim();

        if (contentID.substring(0, 3).equalsIgnoreCase("cid")) {
            contentID = contentID.substring(4);
        }
        DataHandler dataHandler = attachment.getDataHandler(contentID);
        OMText textNode = new OMTextImpl(dataHandler);
        omEle.build();
        child.detach();
        omEle.addChild(textNode);
        return omEle;
View Full Code Here

Examples of org.apache.axis2.attachments.MIMEHelper

    if (fileCacheForAttachments)
    {
      attachmentRepoDir = (String)msgContext.getProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR);
    }
     
    MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString,fileCacheForAttachments,attachmentRepoDir);
    XMLStreamReader reader = XMLInputFactory.newInstance()
        .createXMLStreamReader(
            new BufferedReader(new InputStreamReader(mimeHelper
                .getSOAPPartInputStream())));
    /*
     * put a reference to Attachments in to the message context
     */
    msgContext.setProperty("Attachments", mimeHelper);
    if (mimeHelper.getAttachmentSpecType().equals(MIMEHelper.MTOM_TYPE)) {
      /*
       * Creates the MTOM specific MTOMStAXSOAPModelBuilder
       */
      builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper);
    } else if (mimeHelper.getAttachmentSpecType().equals(
        MIMEHelper.SWA_TYPE)) {
      builder = new StAXSOAPModelBuilder(reader);
    }
    return builder;
  }
View Full Code Here

Examples of org.apache.axis2.attachments.MIMEHelper

  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);
View Full Code Here

Examples of org.apache.axis2.attachments.MIMEHelper

    public OMElement echoAttachment(OMElement omEle) {
        OMElement child  = (OMElement)omEle.getFirstChild();
        OMAttribute attr = child.getFirstAttribute(new QName("href"));
        String contentID = attr.getValue();
        MIMEHelper attachment = (MIMEHelper)msgcts.getProperty(MTOMConstants.ATTACHMENTS);
        contentID = contentID.trim();

        if (contentID.substring(0, 3).equalsIgnoreCase("cid")) {
            contentID = contentID.substring(4);
        }
        DataHandler dataHandler = attachment.getDataHandler(contentID);
        OMText textNode = new OMTextImpl(dataHandler);
        omEle.build();
        child.detach();
        omEle.addChild(textNode);
        return omEle;
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.