本文整理汇总了Java中org.apache.axis2.context.MessageContext.getReplyTo方法的典型用法代码示例。如果您正苦于以下问题:Java MessageContext.getReplyTo方法的具体用法?Java MessageContext.getReplyTo怎么用?Java MessageContext.getReplyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.context.MessageContext
的用法示例。
在下文中一共展示了MessageContext.getReplyTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAsync
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
protected boolean isAsync() {
MessageContext mc = getMessageContext();
return
mc.getMessageID() != null &&
!mc.getMessageID().equals("") &&
mc.getReplyTo() != null &&
!mc.getReplyTo().hasAnonymousAddress();
}
示例2: isSyncReplyAllowed
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
* Returns true if the ReplyTo address matches one of the supported
* anonymous urls. If the ReplyTo is not set, anonymous is assumed, per the Final
* spec. The AddressingInHandler should have set the ReplyTo to non-null in the
* 2004/08 case to ensure the different semantics. (per AXIS2-885)
*
* According to the WS-Addressing Metadata spec the none URI must not be rejected.
*
* @param messageContext
*/
public static boolean isSyncReplyAllowed(MessageContext messageContext) {
EndpointReference replyTo = messageContext.getReplyTo();
if (replyTo == null) {
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug(messageContext.getLogIDString() +
" isSyncReplyAllowed: ReplyTo is null. Returning true");
}
return true;
} else {
return replyTo.hasAnonymousAddress() || replyTo.hasNoneAddress();
}
}
示例3: isReplyRedirected
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
* Returns true if the ReplyTo address does not match one of the supported
* anonymous urls. If the ReplyTo is not set, anonymous is assumed, per the Final
* spec. The AddressingInHandler should have set the ReplyTo to non-null in the
* 2004/08 case to ensure the different semantics. (per AXIS2-885)
*
* @param messageContext
*/
public static boolean isReplyRedirected(MessageContext messageContext) {
EndpointReference replyTo = messageContext.getReplyTo();
if (replyTo == null) {
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug(messageContext.getLogIDString() +
" isReplyRedirected: ReplyTo is null. Returning false");
}
return false;
} else {
return !replyTo.hasAnonymousAddress();
}
}
示例4: executeImpl
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
* Executes the MEP. What this does depends on the specific MEP client. The basic idea is to have the MEP client
* execute and do something with the messages that have been added to it so far. For example, if its an Out-In
* MEP, then if the Out message has been set, then executing the client asks it to send the message and get the
* In message, possibly using a different thread.
*
* @param block Indicates whether execution should block or return ASAP. What block means is of course a
* function of the specific MEP client. IGNORED BY THIS MEP CLIENT.
* @throws AxisFault if something goes wrong during the execution of the MEP.
*/
@Override
public void executeImpl(final boolean block) throws AxisFault {
if (log.isDebugEnabled()) {
log.debug("Entry: OutOptInAxisOperationClient::execute, " + block);
}
if (completed) {
throw new AxisFault(Messages.getMessage("mepiscomplted"));
}
final ConfigurationContext cc = sc.getConfigurationContext();
// copy interesting info from options to message context.
final MessageContext mc = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (mc == null) {
throw new AxisFault(Messages.getMessage("outmsgctxnull"));
}
prepareMessageContext(cc, mc);
if (options.getTransportIn() == null && mc.getTransportIn() == null) {
mc.setTransportIn(ClientUtils.inferInTransport(cc
.getAxisConfiguration(), options, mc));
} else if (mc.getTransportIn() == null) {
mc.setTransportIn(options.getTransportIn());
}
/**
* If a module has set the USE_ASYNC_OPERATIONS option then we override the behaviour for sync calls, and
* effectively USE_CUSTOM_LISTENER too. However we leave real async calls alone.
*/
boolean useAsync = false;
if (!mc.getOptions().isUseSeparateListener()) {
final Boolean useAsyncOption
= (Boolean) mc.getProperty(Constants.Configuration.USE_ASYNC_OPERATIONS);
if (log.isDebugEnabled()) {
log.debug("OutInAxisOperationClient: useAsyncOption " + useAsyncOption);
}
if (useAsyncOption != null) {
useAsync = useAsyncOption.booleanValue();
}
}
final EndpointReference replyTo = mc.getReplyTo();
if (replyTo != null) {
if (replyTo.isWSAddressingAnonymous()
&& replyTo.getAllReferenceParameters() != null) {
mc.setProperty(AddressingConstants.INCLUDE_OPTIONAL_HEADERS, Boolean.TRUE);
}
final String customReplyTo = (String) options.getProperty(Options.CUSTOM_REPLYTO_ADDRESS);
if (!(Options.CUSTOM_REPLYTO_ADDRESS_TRUE.equals(customReplyTo))) {
if (!replyTo.hasAnonymousAddress()) {
useAsync = true;
}
}
}
if (useAsync || mc.getOptions().isUseSeparateListener()) {
sendAsync(useAsync, mc);
} else {
if (block) {
// Send the SOAP Message and receive a response
send(mc);
completed = true;
} else {
sc.getConfigurationContext().getThreadPool().execute(
new NonBlockingInvocationWorker(callback, mc, axisCallback));
}
}
}
示例5: receive
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
*
* @param messageCtx active MessageContext
* @throws AxisFault if a problem occurred
*/
public void receive(final MessageContext messageCtx) throws AxisFault {
if (messageCtx.isPropertyTrue(DO_ASYNC)
|| ((messageCtx.getParameter(DO_ASYNC) != null) &&
JavaUtils.isTrueExplicitly(messageCtx.getParameter(DO_ASYNC).getValue()))) {
String mep = messageCtx.getAxisOperation()
.getMessageExchangePattern();
EndpointReference replyTo = messageCtx.getReplyTo();
// In order to invoke the service in the ASYNC mode, the request
// should contain ReplyTo header if the MEP of the service is not
// InOnly type
if ((!WSDLUtil.isOutputPresentForMEP(mep))
|| (replyTo != null && !replyTo.hasAnonymousAddress())) {
AsyncMessageReceiverWorker worker = new AsyncMessageReceiverWorker(
messageCtx);
messageCtx.getEnvelope().build();
messageCtx.getConfigurationContext().getThreadPool().execute(
worker);
return;
}
}
ThreadContextDescriptor tc = setThreadContext(messageCtx);
try {
invokeBusinessLogic(messageCtx);
} catch (AxisFault fault) {
// signal the transport to rollback the tx, if any
messageCtx.setProperty(Constants.SET_ROLLBACK_ONLY, true);
// If we're in-only, eat this. Otherwise, toss it upwards!
if ((messageCtx.getAxisOperation() instanceof InOnlyAxisOperation) &&
!WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(messageCtx.getAxisOperation().getMessageExchangePattern())) {
log.error(fault);
} else {
fault.setFaultType(Constants.APPLICATION_FAULT);
throw fault;
}
} finally {
restoreThreadContext(tc);
}
}
示例6: inferInTransport
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public static TransportInDescription inferInTransport(AxisConfiguration ac,
Options options,
MessageContext msgCtxt)
throws AxisFault {
String listenerTransportProtocol = options.getTransportInProtocol();
if (listenerTransportProtocol == null) {
EndpointReference replyTo = msgCtxt.getReplyTo();
if (replyTo != null) {
try {
URI uri = new URI(replyTo.getAddress());
listenerTransportProtocol = uri.getScheme();
} catch (URISyntaxException e) {
//need to ignore
}
} else {
//assume listener transport as sender transport
if (msgCtxt.getTransportOut() != null) {
listenerTransportProtocol = msgCtxt.getTransportOut().getName();
}
}
}
TransportInDescription transportIn = null;
if (options.isUseSeparateListener() || msgCtxt.getOptions().isUseSeparateListener()) {
if ((listenerTransportProtocol != null) && !"".equals(listenerTransportProtocol)) {
transportIn = ac.getTransportIn(listenerTransportProtocol);
ListenerManager listenerManager =
msgCtxt.getConfigurationContext().getListenerManager();
if (transportIn == null) {
// TODO : User should not be mandated to give an IN transport. If it is not given, we should
// ask from the ListenerManager to give any available transport for this client.
log.error(Messages.getMessage("unknownTransport",
listenerTransportProtocol));
throw new AxisFault(Messages.getMessage("unknownTransport",
listenerTransportProtocol));
}
synchronized (ClientUtils.class) {
if (!listenerManager.isListenerRunning(transportIn.getName())) {
listenerManager.addListener(transportIn, false);
}
}
}
if (msgCtxt.getAxisService() != null) {
if (!msgCtxt.isEngaged(Constants.MODULE_ADDRESSING)) {
log.error(Messages.getMessage("2channelNeedAddressing"));
throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
}
} else {
if (!ac.isEngaged(Constants.MODULE_ADDRESSING)) {
log.error(Messages.getMessage("2channelNeedAddressing"));
throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
}
}
}
return transportIn;
}