当前位置: 首页>>代码示例>>Java>>正文


Java MessageContext.setDoingMTOM方法代码示例

本文整理汇总了Java中org.apache.axis2.context.MessageContext.setDoingMTOM方法的典型用法代码示例。如果您正苦于以下问题:Java MessageContext.setDoingMTOM方法的具体用法?Java MessageContext.setDoingMTOM怎么用?Java MessageContext.setDoingMTOM使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axis2.context.MessageContext的用法示例。


在下文中一共展示了MessageContext.setDoingMTOM方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOMOutputFormat

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Get the OMOutput format for the given message
 * @param msgContext the axis message context
 * @return the OMOutput format to be used
 */
public static OMOutputFormat getOMOutputFormat(MessageContext msgContext) {

    OMOutputFormat format = new OMOutputFormat();
    msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
    msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));
    msgContext.setDoingREST(TransportUtils.isDoingREST(msgContext));
    format.setSOAP11(msgContext.isSOAP11());
    format.setDoOptimize(msgContext.isDoingMTOM());
    format.setDoingSWA(msgContext.isDoingSwA());

    format.setCharSetEncoding(TransportUtils.getCharSetEncoding(msgContext));
    Object mimeBoundaryProperty = msgContext.getProperty(Constants.Configuration.MIME_BOUNDARY);
    if (mimeBoundaryProperty != null) {
        format.setMimeBoundary((String) mimeBoundaryProperty);
    }
    return format;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:23,代码来源:BaseUtils.java

示例2: processDocument

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public OMElement processDocument(DataSource dataSource,
                                 String contentType,
                                 MessageContext msgContext) throws AxisFault {
    QName wrapperQName = BaseConstants.DEFAULT_BINARY_WRAPPER;
    if (msgContext.getAxisService() != null) {
        Parameter wrapperParam = msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM);
        if (wrapperParam != null) {
            wrapperQName = BaseUtils.getQNameFromString(wrapperParam.getValue());
        }
    }
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMElement wrapper = factory.createOMElement(wrapperQName, null);
    DataHandler dataHandler = new DataHandler(dataSource);
    wrapper.addChild(factory.createOMText(dataHandler, true));
    msgContext.setDoingMTOM(true);
    return wrapper;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:18,代码来源:BinaryBuilder.java

示例3: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Method invoke
 *
 * @param msgContext the current MessageContext
 * @throws AxisFault
 */
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {

    // Check for the REST behaviour, if you desire rest beahaviour
    // put a <parameter name="doREST" value="true"/> at the axis2.xml
    msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
    msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));

    OutputStream out;
    EndpointReference epr = msgContext.getTo();

    if (log.isDebugEnabled()) {
        log.debug("Sending - " + msgContext.getEnvelope().toString());
    }

    if (epr != null) {
        if (!epr.hasNoneAddress()) {
            out = new ByteArrayOutputStream();
            TransportUtils.writeMessage(msgContext, out);
            finalizeSendWithToAddress(msgContext, (ByteArrayOutputStream)out);
        }
    } else {
        out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);

        if (out != null) {
            TransportUtils.writeMessage(msgContext, out);
        } else {
            throw new AxisFault(
                    "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
        }
    }

    TransportUtils.setResponseWritten(msgContext, true);
    
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:42,代码来源:LocalTransportSender.java

示例4: setUp

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    MessageReceiver mr = new AbstractInOutMessageReceiver() {
        @Override
        public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage)
                throws AxisFault {
            
            lastSoapAction = inMessage.getSoapAction();
            if (triggerFault) {
                throw new AxisFault("Triggered SOAP fault as requested");
            } else {
                outMessage.setEnvelope(inMessage.getEnvelope());
                Attachments inAttachments = inMessage.getAttachmentMap();
                Attachments outAttachments = outMessage.getAttachmentMap();
                for (String contentId : inAttachments.getAllContentIDs()) {
                    if (!contentId.equals(inAttachments.getSOAPPartContentID())) {
                        outAttachments.addDataHandler(contentId,
                                inAttachments.getDataHandler(contentId));
                    }
                }
                outMessage.setDoingSwA(inMessage.isDoingSwA());
                outMessage.setDoingMTOM(inMessage.isDoingMTOM());
            }
        }
    };
    UtilServer.deployService(
            Utils.createSimpleService(SERVICE_NAME, mr, null, OPERATION_NAME));
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:29,代码来源:IntegrationTest.java

示例5: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Method invoke
 *
 * @param msgContext the active MessageContext
 * @throws AxisFault
 */
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {

    // Check for the REST behaviour, if you desire rest beahaviour
    // put a <parameter name="doREST" value="true"/> at the axis2.xml
    msgContext.setDoingMTOM(TransportUtils.doWriteMTOM(msgContext));
    msgContext.setDoingSwA(TransportUtils.doWriteSwA(msgContext));

    EndpointReference epr = null;

    if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
        epr = msgContext.getTo();
    }

    try {
        if (log.isDebugEnabled()) {
            log.debug("Response - " + msgContext.getEnvelope().toString());
        }

        if (epr != null) {
            if (!epr.hasNoneAddress()) {
                TransportUtils.writeMessage(msgContext, out);
            }
        } else {
            if (/*(msgContext != null) &&*/ (msgContext.getOperationContext() != null) &&
                    (msgContext.getOperationContext().getMessageContexts() != null)) {
                MessageContext proxyInMessageContext = msgContext.
                        getOperationContext().getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);

                if (proxyInMessageContext != null) {
                    MessageContext initialMessageContext = (MessageContext) proxyInMessageContext.
                            getProperty(LocalTransportReceiver.IN_MESSAGE_CONTEXT);

                    if (initialMessageContext != null) {
                        handleResponse(msgContext, initialMessageContext);
                    } else {
                        out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);

                        if (out != null) {
                            TransportUtils.writeMessage(msgContext, out);
                        } else {
                            throw new AxisFault(
                                    "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
                        }

                    }
                }
            } else {
                out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);

                if (out != null) {
                    TransportUtils.writeMessage(msgContext, out);
                } else {
                    throw new AxisFault(
                            "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
                }
            }
        }
    } catch (AxisFault axisFault) {
        // At this point all we can do is log this error, since it happened while
        // we were sending the response!
        log.error("Error sending response", axisFault);
    }

    TransportUtils.setResponseWritten(msgContext, true);

    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:74,代码来源:LocalResponder.java


注:本文中的org.apache.axis2.context.MessageContext.setDoingMTOM方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。