本文整理汇总了Java中org.apache.cxf.message.Exchange.getOutMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Exchange.getOutMessage方法的具体用法?Java Exchange.getOutMessage怎么用?Java Exchange.getOutMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.message.Exchange
的用法示例。
在下文中一共展示了Exchange.getOutMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeConduit
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
public static void closeConduit(Exchange exchange) throws IOException {
ConduitSelector conduitSelector = null;
synchronized (exchange) {
conduitSelector = exchange.get(ConduitSelector.class);
if (conduitSelector != null) {
exchange.remove(ConduitSelector.class.getName());
}
}
Conduit selectedConduit = null;
Message message = exchange.getInMessage() == null ? exchange
.getOutMessage() : exchange.getInMessage();
if (conduitSelector != null && message != null) {
selectedConduit = conduitSelector.selectConduit(message);
selectedConduit.close(message);
}
//TODO the line below was removed, check the impact on the protobuffer importer/exporter
//selectedConduit.close(message);
}
示例2: getOutMessage
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private Message getOutMessage(Message inMessage) {
Exchange exchange = inMessage.getExchange();
Message outMessage = exchange.getOutMessage();
if (outMessage == null) {
Endpoint endpoint = exchange.get(Endpoint.class);
outMessage = endpoint.getBinding().createMessage();
exchange.setOutMessage(outMessage);
}
outMessage.putAll(inMessage);
return outMessage;
}
示例3: getOutMessage
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
/**
* @param inMessage
* @return Message
*/
private Message getOutMessage(Message inMessage)
{
Exchange exchange = inMessage.getExchange();
Message outMessage = exchange.getOutMessage();
if (outMessage == null)
{
Endpoint endpoint = exchange.get(Endpoint.class);
outMessage = endpoint.getBinding().createMessage();
exchange.setOutMessage(outMessage);
}
outMessage.putAll(inMessage);
return outMessage;
}
示例4: performFailover
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private boolean performFailover(Exchange exchange, InvocationContext invocation) {
Exception prevExchangeFault = (Exception) exchange.remove(Exception.class.getName());
Message outMessage = exchange.getOutMessage();
Exception prevMessageFault = outMessage.getContent(Exception.class);
outMessage.setContent(Exception.class, null);
overrideAddressProperty(invocation.getContext());
Retryable retry = exchange.get(Retryable.class);
exchange.clear();
boolean failover = false;
if (retry != null) {
try {
failover = true;
long delay = getDelayBetweenRetries();
if (delay > 0) {
Thread.sleep(delay);
}
Map<String, Object> context = invocation.getContext();
retry.invoke(invocation.getBindingOperationInfo(), invocation.getParams(), context,
exchange);
} catch (Exception e) {
if (exchange.get(Exception.class) != null) {
exchange.put(Exception.class, prevExchangeFault);
}
if (outMessage.getContent(Exception.class) != null) {
outMessage.setContent(Exception.class, prevMessageFault);
}
}
}
return failover;
}
示例5: isOutbound
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private boolean isOutbound(Message message, Exchange ex) {
return message == ex.getOutMessage()
|| message == ex.getOutFaultMessage();
}
示例6: sendExchange
import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
public void sendExchange(final Exchange exchange, final byte[] request) {
LOG.log(Level.FINE, "ZMQConduit send message");
final Message outMessage = exchange.getOutMessage() == null
? exchange.getOutFaultMessage()
: exchange.getOutMessage();
if (outMessage == null) {
throw new RuntimeException("Exchange to be sent has no outMessage");
}
synchronized (exchange) {
try {
ZMQUtils.sendMessage(zmqSocket, request);
}
catch (ZMQException e) {
if (e.getErrorCode() == ZMQURIConstants.ERR_EFSM) {
LOG.log(Level.WARNING, "The operation can not be executed because the socket is not in correct state. Creating new socket and retrying operation...");
zmqSocket.close();
zmqSocket = ZMQResourceFactory.createSocket(endpointConfig, zmqContext);
ZMQUtils.sendMessage(zmqSocket, request);
}
else {
throw e;
}
}
byte[] reply;
if (isOneway(exchange) || !(endpointConfig.getSocketType().equals(ZMQURIConstants.SocketType.REQ))) {
if (endpointConfig.getSocketType().equals(ZMQURIConstants.SocketType.REQ)) {
reply = ZMQUtils.receiveMessage(zmqSocket);
if ((reply.length == 1 && reply[0] == 0) || !doProcessResponse(outMessage)) {
return;
}
} else {
return;
}
} else {
reply = ZMQUtils.receiveMessage(zmqSocket);
}
Message inMessage = new MessageImpl();
exchange.setInMessage(inMessage);
inMessage.setContent(InputStream.class, new ByteArrayInputStream(reply));
if (exchange.isSynchronous()) {
exchange.notifyAll();
}
}
if (incomingObserver != null) {
incomingObserver.onMessage(exchange.getInMessage());
}
}