Author: mlovett
Date: Wed Jan 17 01:13:32 2007
New Revision: 496970
URL: http://svn.apache.org/viewvc?view=rev&rev=496970
Log:
Move RM Anon URI rewriting to the Application Message Processor
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?view=diff&rev=496970&r1=496969&r2=496970
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
Wed Jan 17 01:13:32 2007
@@ -18,12 +18,9 @@
package org.apache.sandesha2.handlers;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContextFactory;
-import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.handlers.AbstractHandler;
@@ -31,7 +28,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.RMMsgContext;
import org.apache.sandesha2.Sandesha2Constants;
-import org.apache.sandesha2.SandeshaException;
import org.apache.sandesha2.client.SandeshaClientConstants;
import org.apache.sandesha2.i18n.SandeshaMessageHelper;
import org.apache.sandesha2.i18n.SandeshaMessageKeys;
@@ -39,7 +35,6 @@
import org.apache.sandesha2.msgprocessors.ApplicationMsgProcessor;
import org.apache.sandesha2.msgprocessors.MsgProcessor;
import org.apache.sandesha2.msgprocessors.MsgProcessorFactory;
-import org.apache.sandesha2.policy.SandeshaPolicyBean;
import org.apache.sandesha2.storage.StorageManager;
import org.apache.sandesha2.storage.Transaction;
import org.apache.sandesha2.util.MsgInitializer;
@@ -123,13 +118,6 @@
try {
transaction = storageManager.getTransaction();
- // Re-write the WS-A anonymous URI, if we support the
RM anonymous URI
- SandeshaPolicyBean policy =
SandeshaUtil.getPropertyBean(context.getAxisConfiguration());
- if(policy.isEnableRMAnonURI()) {
- EndpointReference replyTo =
rewriteEPR(msgCtx.getReplyTo(), msgCtx);
- msgCtx.setReplyTo(replyTo);
- }
-
// getting rm message
RMMsgContext rmMsgCtx =
MsgInitializer.initializeMessage(msgCtx);
@@ -206,42 +194,4 @@
return Sandesha2Constants.OUT_HANDLER_NAME;
}
- public EndpointReference rewriteEPR(EndpointReference epr,
MessageContext mc)
- throws SandeshaException
- {
- if (log.isDebugEnabled())
- log.debug("Exit: SandeshaOutHandler::rewriteEPR " +
epr);
-
- // Handle EPRs that have not yet been set. These are
effectively WS-A anon, and therefore
- // we can rewrite them.
- if(epr == null) epr = new EndpointReference(null);
-
- String address = epr.getAddress();
- if(address == null ||
- AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(address)
||
-
AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(address)) {
- // We use the service context to co-ordinate the RM
anon uuid, so that several
- // invocations of the same target will yield stable
replyTo addresses.
- String uuid = null;
- ServiceContext sc = mc.getServiceContext();
- if(sc == null) {
- String msg =
SandeshaMessageHelper.getMessage(SandeshaMessageKeys.serviceContextNotSet);
- throw new SandeshaException(msg);
- }
- synchronized (sc) {
- uuid = (String)
sc.getProperty(Sandesha2Constants.RM_ANON_UUID);
- if(uuid == null) {
- uuid = SandeshaUtil.getUUID();
-
sc.setProperty(Sandesha2Constants.RM_ANON_UUID, uuid);
- }
- }
-
- if(log.isDebugEnabled()) log.debug("Rewriting EPR with
UUID " + uuid);
-
epr.setAddress(Sandesha2Constants.SPEC_2006_08.ANONYMOUS_URI_PREFIX + uuid);
- }
-
- if (log.isDebugEnabled())
- log.debug("Exit: SandeshaOutHandler::rewriteEPR " +
epr);
- return epr;
- }
}
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?view=diff&rev=496970&r1=496969&r2=496970
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
Wed Jan 17 01:13:32 2007
@@ -20,13 +20,16 @@
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.RelatesTo;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.RMMsgContext;
@@ -36,6 +39,7 @@
import org.apache.sandesha2.client.SandeshaListener;
import org.apache.sandesha2.i18n.SandeshaMessageHelper;
import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.policy.SandeshaPolicyBean;
import org.apache.sandesha2.security.SecurityManager;
import org.apache.sandesha2.security.SecurityToken;
import org.apache.sandesha2.storage.StorageManager;
@@ -90,6 +94,20 @@
MessageContext msgContext = rmMsgCtx.getMessageContext();
ConfigurationContext configContext =
msgContext.getConfigurationContext();
+ // Re-write the WS-A anonymous URI, if we support the RM
anonymous URI. We only
+ // need to rewrite the replyTo EPR if we have an out-in MEP.
+ SandeshaPolicyBean policy =
SandeshaUtil.getPropertyBean(configContext.getAxisConfiguration());
+ if(policy.isEnableRMAnonURI()) {
+ AxisOperation op = msgContext.getAxisOperation();
+ if(op != null) {
+ int mep = op.getAxisSpecifMEPConstant();
+ if(mep ==
WSDL20_2004Constants.MEP_CONSTANT_OUT_IN) {
+ EndpointReference replyTo =
rewriteEPR(msgContext.getReplyTo(), msgContext);
+ msgContext.setReplyTo(replyTo);
+ }
+ }
+ }
+
// setting the Fault callback
SandeshaListener faultCallback = (SandeshaListener)
msgContext.getOptions().getProperty(
SandeshaClientConstants.SANDESHA_LISTENER);
@@ -689,4 +707,44 @@
if (log.isDebugEnabled())
log.debug("Exit:
ApplicationMsgProcessor::processResponseMessage");
}
+
+ private EndpointReference rewriteEPR(EndpointReference epr,
MessageContext mc)
+ throws SandeshaException
+ {
+ if (log.isDebugEnabled())
+ log.debug("Exit: SandeshaOutHandler::rewriteEPR " +
epr);
+
+ // Handle EPRs that have not yet been set. These are
effectively WS-A anon, and therefore
+ // we can rewrite them.
+ if(epr == null) epr = new EndpointReference(null);
+
+ String address = epr.getAddress();
+ if(address == null ||
+ AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(address)
||
+
AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(address)) {
+ // We use the service context to co-ordinate the RM
anon uuid, so that several
+ // invocations of the same target will yield stable
replyTo addresses.
+ String uuid = null;
+ ServiceContext sc = mc.getServiceContext();
+ if(sc == null) {
+ String msg =
SandeshaMessageHelper.getMessage(SandeshaMessageKeys.serviceContextNotSet);
+ throw new SandeshaException(msg);
+ }
+ synchronized (sc) {
+ uuid = (String)
sc.getProperty(Sandesha2Constants.RM_ANON_UUID);
+ if(uuid == null) {
+ uuid = SandeshaUtil.getUUID();
+
sc.setProperty(Sandesha2Constants.RM_ANON_UUID, uuid);
+ }
+ }
+
+ if(log.isDebugEnabled()) log.debug("Rewriting EPR with
UUID " + uuid);
+
epr.setAddress(Sandesha2Constants.SPEC_2006_08.ANONYMOUS_URI_PREFIX + uuid);
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Exit: SandeshaOutHandler::rewriteEPR " +
epr);
+ return epr;
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]