本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}