diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-26 12:41:11 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-26 12:41:11 +0000 |
commit | f5d98d5e2a84c66a931d877df4bb4c7bf851b376 (patch) | |
tree | 5cff2748d5c1a95a3a8b16ddd1a13b2b778ef53e /sca-java-2.x/trunk/modules/core/src/main/java | |
parent | c0e362c81eecf5215c58846fba7de9160ac70af1 (diff) |
TUSCANY-3932 - sample of how the structural URI could be passed over a remote binding (in this case binding.ws) and picked up on the service side in the binding.sca case.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1162090 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src/main/java')
-rw-r--r-- | sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java index e10ecf178b..9dba10f605 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java @@ -24,6 +24,7 @@ import java.util.List; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.assembly.SCABinding; import org.apache.tuscany.sca.assembly.builder.BindingBuilder; import org.apache.tuscany.sca.assembly.builder.BuilderContext; import org.apache.tuscany.sca.context.CompositeContext; @@ -131,6 +132,26 @@ public class CallbackServiceReferenceImpl<B> extends ServiceReferenceImpl<B> { epr.setTargetEndpoint(resolvedEndpoint); // TUSCANY-3932 + // If it's the default binding then we're going to look the callback endpoint + // up in the registry. Most remote protocols, which may be used as delegates + // or binding.sca will deal in absolution callback address and send the + // callback enbdpoint strutural URL separately. In this case flip the binding + // back to the structure URL. + // TODO - all this creation of endpoints by the binding to represent callbacks + // is confusing. Code here will change if we tidy it up. + if (epr.getBinding().getType().equals(SCABinding.TYPE)){ + // assume that we're going to look up the callback endpoint in the + // registry + Message msgContext = ThreadMessageContext.getMessageContext(); + if (msgContext != null){ + String callbackEPURI = (String)msgContext.getHeaders().get("CALLBACK_EP_URI"); + if (callbackEPURI != null){ + resolvedEndpoint.setURI(callbackEPURI); + } + } + } +/* + // TUSCANY-3932 // If the resolved endpoint has a binding with a absolute URI then assume // that URL has been passed in in the forward message and really treat it // as a resolved endpoint. @@ -151,7 +172,7 @@ public class CallbackServiceReferenceImpl<B> extends ServiceReferenceImpl<B> { epr.setUnresolved(false); } } - +*/ return epr; } catch (CloneNotSupportedException e) { // will not happen |