本文整理了Java中org.apache.axis2.context.MessageContext.getOptions()
方法的一些代码示例,展示了MessageContext.getOptions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MessageContext.getOptions()
方法的具体详情如下:
包路径:org.apache.axis2.context.MessageContext
类名称:MessageContext
方法名:getOptions
暂无
代码示例来源:origin: org.apache.sandesha2/sandesha2-core
public String getRMSpecVersion () {
if (rmSpecVersion==null) {
//this may hv been set in the Options object.
if (msgContext!=null && msgContext.getOptions()!=null)
rmSpecVersion = (String) msgContext.getOptions().getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
}
return rmSpecVersion;
}
代码示例来源:origin: org.apache.sandesha2/sandesha2-core
private void makeMessageReadyForReinjection(MessageContext messageContext) {
messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, null);
messageContext.getOptions().setMessageId(null);
messageContext.getOptions().setTo(null);
messageContext.getOptions().setAction(null);
messageContext.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, Sandesha2Constants.VALUE_TRUE);
}
代码示例来源:origin: wso2/wso2-synapse
/**
* Properties in client options such as inbound and outbound policy files used for outgoing
* request may still be present. These need to be removed before sending the response as
* they are no longer required.
*
* @param msgCtx Axis2 MessageContext
*/
private void removeUnwantedClientOptions(MessageContext msgCtx) {
if (msgCtx.getOptions() != null && msgCtx.getOptions().getParent() != null &&
msgCtx.getOptions().getParent().getParent() != null) {
Options clientOptions = msgCtx.getOptions().getParent().getParent();
clientOptions.setProperty(SynapseConstants.RAMPART_OUT_POLICY, null);
clientOptions.setProperty(SynapseConstants.RAMPART_IN_POLICY, null);
}
}
代码示例来源:origin: org.apache.sandesha2/sandesha2-core
public boolean processOutMessage(RMMsgContext rmMsgCtx, Transaction transaction) {
if (log.isDebugEnabled())
log.debug("Enter: CreateSeqMsgProcessor::processOutMessage");
MessageContext msgCtx = rmMsgCtx.getMessageContext();
// adding the SANDESHA_LISTENER
SandeshaListener faultCallback = (SandeshaListener) msgCtx.getOptions().getProperty(
SandeshaClientConstants.SANDESHA_LISTENER);
if (faultCallback != null) {
OperationContext operationContext = msgCtx.getOperationContext();
if (operationContext != null) {
operationContext.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, faultCallback);
}
}
if (log.isDebugEnabled())
log.debug("Exit: CreateSeqMsgProcessor::processOutMessage " + Boolean.FALSE);
return false;
}
代码示例来源:origin: apache/axis2-java
private void extractFaultToEPRInformation(SOAPHeaderBlock soapHeaderBlock,
String addressingNamespace,
MessageContext messageContext) throws AxisFault {
Options messageContextOptions = messageContext.getOptions();
EndpointReference epr = messageContextOptions.getFaultTo();
if (epr == null) {
epr = new EndpointReference("");
messageContextOptions.setFaultTo(epr);
}
extractEPRInformation(soapHeaderBlock, epr, addressingNamespace, messageContext);
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace("extractFaultToEPRInformation: Extracted FaultTo EPR: " + epr);
}
soapHeaderBlock.setProcessed();
}
代码示例来源:origin: apache/axis2-java
private void extractReplyToEPRInformation(SOAPHeaderBlock soapHeaderBlock,
String addressingNamespace,
MessageContext messageContext) throws AxisFault {
Options messageContextOptions = messageContext.getOptions();
EndpointReference epr = messageContextOptions.getReplyTo();
if (epr == null) {
epr = new EndpointReference("");
messageContextOptions.setReplyTo(epr);
}
extractEPRInformation(soapHeaderBlock, epr, addressingNamespace, messageContext);
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace("extractReplyToEPRInformation: Extracted ReplyTo EPR: " + epr);
}
soapHeaderBlock.setProcessed();
}
代码示例来源:origin: holodeck-b2b/Holodeck-B2B
@Override
public InvocationResponse invoke(final MessageContext mc) {
// Get current set of options
final Options options = mc.getOptions();
if (mc.isServerSide()) {
// Acting as server, add HTTP Server header. Due to a bug in Axis we can't use the MC HTTPConstants.SERVER
// Option and must set a response parameter directly
final AxisHttpResponse resp = (AxisHttpResponse) mc.getProperty(Constants.OUT_TRANSPORT_INFO);
resp.setHeader("Server", HTTP_HDR_VALUE);
} else
// Acting as client. add HTTP User-Agent header
options.setProperty(HTTPConstants.USER_AGENT, HTTP_HDR_VALUE);
return InvocationResponse.CONTINUE;
}
代码示例来源:origin: apache/axis2-java
private void extractFromEPRInformation(SOAPHeaderBlock soapHeaderBlock,
String addressingNamespace,
MessageContext messageContext) throws AxisFault {
Options messageContextOptions = messageContext.getOptions();
EndpointReference epr = messageContextOptions.getFrom();
if (epr == null) {
epr = new EndpointReference(
""); // I don't know the address now. Let me pass the empty string now and fill this
// once I process the Elements under this.
messageContextOptions.setFrom(epr);
}
extractEPRInformation(soapHeaderBlock, epr, addressingNamespace, messageContext);
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace("extractFromEPRInformation: Extracted From EPR: " + epr);
}
soapHeaderBlock.setProcessed();
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-runtime-axis2
protected Object invokeTargetOneWay(Message msg) throws AxisFault {
WSAxis2BindingContext bindingContext = msg.getBindingContext();
OperationClient operationClient = bindingContext.getAxisOperationClient();
// ensure connections are tracked so that they can be closed by the reference binding
MessageContext requestMC = operationClient.getMessageContext("Out");
//requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
Options opt = requestMC.getOptions();
opt.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
opt.setUseSeparateListener(true);
opt.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,Boolean.TRUE);
operationClient.execute(false);
// REVIEW it seems ok to return null
return null;
}
代码示例来源:origin: org.apache.axis2/axis2-kernel
public void receive(MessageContext msgContext) throws AxisFault {
RelatesTo relatesTO = msgContext.getOptions().getRelatesTo();
if (relatesTO == null) {
throw new AxisFault("Cannot identify correct Callback object. RelatesTo is null");
}
String messageID = relatesTO.getValue();
Object callbackObj = callbackStore.remove(messageID);
if (log.isDebugEnabled()) log.debug("CallbackReceiver: receive found callback " + callbackObj + ", " + messageID + ", " + this + ", " + msgContext.getAxisOperation());
if (callbackObj == null) {
throw new AxisFault("The Callback for MessageID " + messageID + " was not found");
}
if (callbackObj instanceof AxisCallback) {
AxisCallback axisCallback = (AxisCallback)callbackObj;
if (msgContext.isFault()) {
axisCallback.onFault(msgContext);
} else {
axisCallback.onMessage(msgContext);
}
// Either way we're done.
axisCallback.onComplete();
return;
}
}
代码示例来源:origin: apache/axis2-java
public void receive(MessageContext msgContext) throws AxisFault {
RelatesTo relatesTO = msgContext.getOptions().getRelatesTo();
if (relatesTO == null) {
throw new AxisFault("Cannot identify correct Callback object. RelatesTo is null");
}
String messageID = relatesTO.getValue();
Object callbackObj = callbackStore.remove(messageID);
if (log.isDebugEnabled()) log.debug("CallbackReceiver: receive found callback " + callbackObj + ", " + messageID + ", " + this + ", " + msgContext.getAxisOperation());
if (callbackObj == null) {
throw new AxisFault("The Callback for MessageID " + messageID + " was not found");
}
if (callbackObj instanceof AxisCallback) {
AxisCallback axisCallback = (AxisCallback)callbackObj;
if (msgContext.isFault()) {
axisCallback.onFault(msgContext);
} else {
axisCallback.onMessage(msgContext);
}
// Either way we're done.
axisCallback.onComplete();
return;
}
}
代码示例来源:origin: org.apache.axis2/axis2-transport-local
public void processMessage(MessageContext inMessageContext,
InputStream in,
OutputStream response) throws AxisFault {
if (this.confContext == null) {
this.confContext = inMessageContext.getConfigurationContext();
}
this.inMessageContext = inMessageContext;
EndpointReference to = inMessageContext.getTo();
String action = inMessageContext.getOptions().getAction();
processMessage(in, to, action, response);
}
代码示例来源:origin: apache/axis2-java
public void processMessage(MessageContext inMessageContext,
InputStream in,
OutputStream response) throws AxisFault {
if (this.confContext == null) {
this.confContext = inMessageContext.getConfigurationContext();
}
this.inMessageContext = inMessageContext;
EndpointReference to = inMessageContext.getTo();
String action = inMessageContext.getOptions().getAction();
processMessage(in, to, action, response);
}
代码示例来源:origin: apache/axis2-java
private void extractMessageIDInformation(SOAPHeaderBlock soapHeaderBlock,
MessageContext messageContext) throws AxisFault {
messageContext.getOptions().setMessageId(soapHeaderBlock.getText());
ArrayList attributes = extractAttributesFromSOAPHeaderBlock(soapHeaderBlock);
if (attributes != null) {
messageContext.setProperty(AddressingConstants.MESSAGEID_ATTRIBUTES, attributes);
}
soapHeaderBlock.setProcessed();
}
代码示例来源:origin: org.apache.sandesha2/sandesha2-core
/**
* Clone the MessageContext
* @param oldMsg
* @return
* @throws AxisFault
*/
public static MessageContext cloneMessageContext (MessageContext oldMsg) throws AxisFault {
MessageContext newMsg = new MessageContext ();
newMsg.setOptions(new Options (oldMsg.getOptions()));
// Create a copy of the envelope
SOAPEnvelope oldEnvelope = oldMsg.getEnvelope();
if (oldEnvelope != null) {
SOAPEnvelope newEnvelope = copySOAPEnvelope(oldMsg.getEnvelope());
newMsg.setEnvelope(newEnvelope);
}
newMsg.setConfigurationContext(oldMsg.getConfigurationContext());
newMsg.setAxisService(oldMsg.getAxisService());
newMsg.setTransportOut(oldMsg.getTransportOut());
newMsg.setTransportIn(oldMsg.getTransportIn());
//Copy property objects from oldMsg to newMsg
copyConfiguredProperties(oldMsg,newMsg);
return newMsg;
}
代码示例来源:origin: org.wso2.mercury/mercury-core
private MessageContext getNewMessageContextUsingAxis2Info(CreateSequenceMessage createSequenceMessage)
throws AxisFault, RMMessageBuildingException {
MessageContext messageContext = new MessageContext();
messageContext.setServiceContext(this.axis2Info.getServiceContext());
messageContext.setEnvelope(createSequenceMessage.toSOAPEnvelope());
messageContext.setMessageID(UUIDGenerator.getUUID());
messageContext.setTransportIn(this.axis2Info.getTransportIn());
messageContext.setTransportOut(this.axis2Info.getTransportOut());
messageContext.setReplyTo(this.ackToEpr);
messageContext.setProperty(MercuryConstants.PROCESS_RM_CONTROL_MESSAGE, Constants.VALUE_TRUE);
messageContext.setOptions(new Options());
// set the correct options
messageContext.getOptions().setTo(this.axis2Info.getOptions().getTo());
messageContext.getOptions().setUseSeparateListener(this.axis2Info.getOptions().isUseSeparateListener());
messageContext.setServerSide(this.axis2Info.isServerSide());
return messageContext;
}
代码示例来源:origin: org.wso2.mercury/mercury-core
private Axis2Info getAxis2Info(MessageContext messageContext,
String acksToAddress,
String addressingNamespaceURI) throws AxisFault {
Axis2Info axis2Info = new Axis2Info();
axis2Info.setServiceContext(messageContext.getServiceContext());
axis2Info.setOptions(messageContext.getOptions());
axis2Info.setTransportIn(messageContext.getTransportIn());
TransportOutDescription transportOut = ClientUtils.inferOutTransport(
messageContext.getConfigurationContext().getAxisConfiguration(),
new EndpointReference(acksToAddress), messageContext);
axis2Info.setTransportOut(transportOut);
axis2Info.setServerSide(messageContext.isServerSide());
axis2Info.setSoapNamespaceURI(messageContext.getEnvelope().getNamespace().getNamespaceURI());
axis2Info.setAddressingNamespaceURI(addressingNamespaceURI);
axis2Info.setProperties(messageContext.getProperties());
return axis2Info;
}
代码示例来源:origin: wso2/wso2-synapse
private boolean handle202(MessageContext requestMsgContext) throws AxisFault {
if (requestMsgContext.isPropertyTrue(NhttpConstants.IGNORE_SC_ACCEPTED)) {
// We should not further process this 202 response - Ignore it
return true;
}
MessageReceiver mr = requestMsgContext.getAxisOperation().getMessageReceiver();
MessageContext responseMsgCtx = requestMsgContext.getOperationContext().
getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
if (responseMsgCtx == null || requestMsgContext.getOptions().isUseSeparateListener()) {
// Most probably a response from a dual channel invocation
// Inject directly into the SynapseCallbackReceiver
requestMsgContext.setProperty(NhttpConstants.HTTP_202_RECEIVED, "true");
mr.receive(requestMsgContext);
return true;
}
return false;
}
代码示例来源:origin: org.apache.axis2.transport/axis2-transport-xmpp
/**
* Extract connection details from client options
* @param serverCredentials
* @param msgContext
*/
private void getConnectionDetailsFromClientOptions(MessageContext msgContext){
Options clientOptions = msgContext.getOptions();
if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_USERNAME) != null){
serverCredentials.setAccountName((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_USERNAME));
}
if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_PASSWORD) != null){
serverCredentials.setPassword((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_PASSWORD));
}
if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_URL) != null){
serverCredentials.setServerUrl((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_URL));
}
if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_TYPE) != null){
serverCredentials.setServerType((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_TYPE));
}
}
代码示例来源:origin: apache/axis2-java
/**
* Extract connection details from client options
* @param serverCredentials
* @param msgContext
*/
private void getConnectionDetailsFromClientOptions(MessageContext msgContext){
Options clientOptions = msgContext.getOptions();
if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_USERNAME) != null){
serverCredentials.setAccountName((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_USERNAME));
}
if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_PASSWORD) != null){
serverCredentials.setPassword((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_PASSWORD));
}
if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_URL) != null){
serverCredentials.setServerUrl((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_URL));
}
if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_TYPE) != null){
serverCredentials.setServerType((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_TYPE));
}
}
内容来源于网络,如有侵权,请联系作者删除!