cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r529292 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/endpoint/ api/src/main/java/org/apache/cxf/message/ rt/bindings/http/ rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ rt/core/src/main/java/org/apache/cxf/e...
Date Mon, 16 Apr 2007 15:42:56 GMT
Author: eglynn
Date: Mon Apr 16 08:42:53 2007
New Revision: 529292

URL: http://svn.apache.org/viewvc?view=rev&rev=529292
Log:
Support for configurable conduit selection strategy

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java   (with props)
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java   (with props)
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
    incubator/cxf/trunk/rt/bindings/http/pom.xml
    incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java
    incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
    incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
    incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AbstractPolicyInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java?view=auto&rev=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java Mon Apr 16 08:42:53 2007
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.endpoint;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.MessageObserver;
+
+
+/**
+ * Abstract base class holding logic common to any ConduitSelector
+ * that retreives a Conduit from the ConduitInitiator.
+ */
+public abstract class AbstractConduitSelector implements ConduitSelector {
+
+    private Conduit selectedConduit;
+
+    /**
+     * Constructor, allowing a specific conduit to override normal selection.
+     * 
+     * @param c specific conduit
+     */
+    public AbstractConduitSelector(Conduit c) {
+        selectedConduit = c;
+    }
+    
+    /**
+     * Mechanics to actually get the Conduit from the ConduitInitiator
+     * if necessary.
+     * 
+     * @param message the current Message
+     */
+    protected Conduit getSelectedConduit(Message message) {
+        if (selectedConduit == null) {
+            Exchange exchange = message.getExchange();
+            Endpoint endpoint = exchange.get(Endpoint.class);
+            EndpointInfo ei = endpoint.getEndpointInfo();
+            String transportID = ei.getTransportId();
+            try {
+                ConduitInitiatorManager conduitInitiatorMgr =
+                    getBus(exchange).getExtension(ConduitInitiatorManager.class);
+                if (conduitInitiatorMgr != null) {
+                    ConduitInitiator conduitInitiator =
+                        conduitInitiatorMgr.getConduitInitiator(transportID);
+                    if (conduitInitiator != null) {
+                        selectedConduit = conduitInitiator.getConduit(ei);
+                        MessageObserver observer = 
+                            exchange.get(MessageObserver.class);
+                        if (observer != null) {
+                            selectedConduit.setMessageObserver(observer);
+                        } else {
+                            getLogger().warning("MessageObserver not found");
+                        }
+                    } else {
+                        getLogger().warning("ConduitInitiator not found: "
+                                            + ei.getAddress());
+                    }
+                } else {
+                    getLogger().warning("ConduitInitiatorManager not found");
+                }
+            } catch (BusException ex) {
+                throw new Fault(ex);
+            } catch (IOException ex) {
+                throw new Fault(ex);
+            }
+        }
+        return selectedConduit;
+    }
+    
+    /**
+     * Get the associated Bus instance from the exchange.
+     * 
+     * @param exchange the current exchange
+     * @return the Bus instance
+     */
+    private Bus getBus(Exchange exchange) {
+        return exchange.get(Bus.class);
+    }
+    
+    /**
+     * @return the logger to use
+     */
+    protected abstract Logger getLogger();
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java Mon Apr 16 08:42:53 2007
@@ -78,4 +78,18 @@
      * @return Conduit
      */
     Conduit getConduit();
+    
+    /**
+     * Get the ConduitSelector responsible for retreiving the Conduit.
+     * 
+     * @return the current ConduitSelector
+     */
+    ConduitSelector getConduitSelector();
+
+    /**
+     * Set the ConduitSelector responsible for retreiving the Conduit.
+     * 
+     * @param selector the ConduitSelector to use
+     */
+    void setConduitSelector(ConduitSelector selector);
 }

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java?view=auto&rev=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java Mon Apr 16 08:42:53 2007
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.endpoint;
+
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Conduit;
+
+
+/**
+ * Strategy for retreival of a Conduit to mediate an outbound message.
+ * A specific instance implementing a particular strategy may be injected
+ * into the Client via config.
+ */
+public interface ConduitSelector {
+    
+    /**
+     * Called prior to the interceptor chain being traversed.
+     * This is the point at which an eager strategy would retrieve
+     * a Conduit.
+     * 
+     * @param message the current Message
+     */
+    void prepare(Message message);
+
+    /**
+     * Called when a Conduit is actually required.
+     * This is the point at which a lazy strategy would retrieve
+     * a Conduit.
+     * 
+     * @param message
+     * @return the Conduit to use for mediation of the message
+     */
+    Conduit selectConduit(Message message);
+    
+    /**
+     * Called on completion of the MEP for which the Conduit was required.
+     * This is the point at which a one-shot strategy would dispose of
+     * the Conduit.
+     * 
+     * @param exchange represents the completed MEP
+     */
+    void complete(Exchange exchange);
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java?view=auto&rev=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java Mon Apr 16 08:42:53 2007
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.endpoint;
+
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Conduit;
+
+/**
+ * Strategy for lazy deferred retreival of a Conduit to mediate an 
+ * outbound message.
+ */
+public class DeferredConduitSelector extends AbstractConduitSelector {
+    
+    private static final Logger LOG =
+        LogUtils.getL7dLogger(DeferredConduitSelector.class);
+    
+    /**
+     * Normal constructor.
+     */
+    public DeferredConduitSelector() {
+        this(null);
+    }
+    
+    /**
+     * Constructor, allowing a specific conduit to override normal selection.
+     * 
+     * @param c specific conduit
+     */
+    public DeferredConduitSelector(Conduit c) {
+        super(c);
+    }
+
+    public void prepare(Message message) {
+        // nothing to do
+    }
+
+    public Conduit selectConduit(Message message) {
+        return getSelectedConduit(message);
+    }
+
+    public void complete(Exchange exchange) {
+        // nothing to do
+    }
+
+    /**
+     * @return the logger to use
+     */
+    protected Logger getLogger() {
+        return LOG;
+    }
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java?view=auto&rev=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java Mon Apr 16 08:42:53 2007
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.endpoint;
+
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Conduit;
+
+/**
+ * Strategy for null Conduit retrieval. 
+ * An instance of this class is set on the Exchange to clear
+ * the current ConduitSelector, as a work-around for broken 
+ * Exchange.remove(ConduitSelector.class) semantics.
+ */
+public class NullConduitSelector implements ConduitSelector {
+
+    public void prepare(Message message) {
+        // nothing to do
+    }
+
+    public Conduit selectConduit(Message message) {
+        return null;
+    }
+
+    public void complete(Exchange exchange) {
+        // nothing to do
+    }
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java?view=auto&rev=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java Mon Apr 16 08:42:53 2007
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.endpoint;
+
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.MessageObserver;
+
+
+/**
+ * Strategy for retreival of a pre-existing Conduit to mediate an 
+ * outbound message.
+ */
+public class PreexistingConduitSelector implements
+    ConduitSelector {
+
+    private Conduit selectedConduit;
+
+    /**
+     * Constructor.
+     * 
+     * @param c the pre-existing Conduit.
+     */
+    public PreexistingConduitSelector(Conduit c) {
+        selectedConduit = c;
+    }
+
+    /**
+     * Called prior to the interceptor chain being traversed.
+     * 
+     * @param message the current Message
+     */
+    public void prepare(Message message) {
+        MessageObserver observer = 
+            message.getExchange().get(MessageObserver.class);
+        if (observer != null) {
+            selectedConduit.setMessageObserver(observer);
+        }
+    }
+
+    /**
+     * Called when a Conduit is actually required.
+     * 
+     * @param message
+     * @return the Conduit to use for mediation of the message
+     */
+    public Conduit selectConduit(Message message) {
+        return selectedConduit;
+    }
+
+    /**
+     * Called on completion of the MEP for which the Conduit was required.
+     * 
+     * @param exchange represents the completed MEP
+     */
+    public void complete(Exchange exchange) {
+        // nothing to do
+    }
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java?view=auto&rev=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java Mon Apr 16 08:42:53 2007
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+package org.apache.cxf.endpoint;
+
+import java.util.logging.Logger;
+
+//import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Conduit;
+
+
+/**
+ * Strategy for eager upfront retreival of a Conduit to mediate an 
+ * outbound message.
+ */
+public class UpfrontConduitSelector extends AbstractConduitSelector {
+
+    private static final Logger LOG =
+        LogUtils.getL7dLogger(UpfrontConduitSelector.class);
+    
+    /**
+     * Normal constructor.
+     */
+    public UpfrontConduitSelector() {
+        this(null);
+    }
+    
+    /**
+     * Constructor, allowing a specific conduit to override normal selection.
+     * 
+     * @param c specific conduit
+     */
+    public UpfrontConduitSelector(Conduit c) {
+        super(c);
+    }
+
+    /**
+     * Called prior to the interceptor chain being traversed.
+     * 
+     * @param message the current Message
+     */
+    public void prepare(Message message) {
+        getSelectedConduit(message);
+    }
+    
+    /**
+     * Called when a Conduit is actually required.
+     * 
+     * @param message
+     * @return the Conduit to use for mediation of the message
+     */
+    public Conduit selectConduit(Message message) {
+        return getSelectedConduit(message);
+    }
+    
+    /**
+     * Called on completion of the MEP for which the Conduit was required.
+     * 
+     * @param exchange represents the completed MEP
+     */
+    public void complete(Exchange exchange) {
+        // nothing to do
+    }
+    
+    /**
+     * @return the logger to use
+     */
+    protected Logger getLogger() {
+        return LOG;
+    }
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java Mon Apr 16 08:42:53 2007
@@ -24,7 +24,6 @@
 import java.util.Set;
 
 import org.apache.cxf.interceptor.InterceptorChain;
-import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 
 /**
@@ -78,10 +77,6 @@
 
     public void setMessage(Message message) {
         this.message = message;
-    }
-
-    public Conduit getConduit() {
-        return message.getConduit();
     }
     
     public Destination getDestination() {

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java Mon Apr 16 08:42:53 2007
@@ -49,9 +49,10 @@
     void setDestination(Destination destination);
 
     /**
+     * @param message the associated message
      * @return the associated outgoing Conduit (may be anonymous)
      */
-    Conduit getConduit();
+    Conduit getConduit(Message message);
 
     /**
      * @param conduit the associated outgoing Conduit 

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java Mon Apr 16 08:42:53 2007
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.message;
 
+import org.apache.cxf.endpoint.ConduitSelector;
+import org.apache.cxf.endpoint.PreexistingConduitSelector;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.Session;
@@ -26,7 +28,6 @@
 public class ExchangeImpl extends StringMapImpl implements Exchange {
 
     private Destination destination;
-    private Conduit conduit;
     private boolean oneWay;
     
     private Message inMessage;
@@ -44,8 +45,10 @@
         return inMessage;
     }
 
-    public Conduit getConduit() {
-        return conduit;
+    public Conduit getConduit(Message message) {
+        return get(ConduitSelector.class) != null
+               ? get(ConduitSelector.class).selectConduit(message)
+               : null;
     }
 
     public Message getOutMessage() {
@@ -82,7 +85,7 @@
     }
 
     public void setConduit(Conduit c) {
-        conduit = c;
+        put(ConduitSelector.class, new PreexistingConduitSelector(c));
     }
 
     public void setOutMessage(Message m) {

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Mon Apr 16 08:42:53 2007
@@ -23,7 +23,6 @@
 import java.util.Set;
 
 import org.apache.cxf.interceptor.InterceptorChain;
-import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 
 public interface Message extends StringMap {
@@ -68,11 +67,6 @@
     
     InterceptorChain getInterceptorChain();
     void setInterceptorChain(InterceptorChain chain);
-    
-    /**
-     * @return the associated Conduit if message is outbound, null otherwise
-     */
-    Conduit getConduit();
 
     /**
      * @return the associated Destination if message is inbound, null otherwise

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java Mon Apr 16 08:42:53 2007
@@ -28,12 +28,10 @@
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 
 public class MessageImpl extends StringMapImpl implements Message {
     private Collection<Attachment> attachments;
-    private Conduit conduit;
     private Destination destination;
     private Exchange exchange;
     private String id;
@@ -53,10 +51,6 @@
         return null;
     }
     
-    public Conduit getConduit() {
-        return conduit;
-    }
-
     public Destination getDestination() {
         return destination;
     }
@@ -83,10 +77,6 @@
 
     public Set<Class<?>> getContentFormats() {
         return contents.keySet();
-    }
-
-    public void setConduit(Conduit c) {
-        this.conduit = c;
     }
 
     public void setDestination(Destination d) {

Modified: incubator/cxf/trunk/rt/bindings/http/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/pom.xml?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/pom.xml (original)
+++ incubator/cxf/trunk/rt/bindings/http/pom.xml Mon Apr 16 08:42:53 2007
@@ -34,7 +34,7 @@
         <dependency>
             <groupId>org.codehaus.jra</groupId>
             <artifactId>jra</artifactId>
-            <version>1.0-alpha-3</version>
+            <version>1.0-alpha-2</version>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>

Modified: incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java Mon Apr 16 08:42:53 2007
@@ -79,7 +79,7 @@
         ex.setInMessage(m);
 
         Conduit c = getLocalConduit("local://" + server);
-        m.setConduit(c);
+        ex.setConduit(c);
 
         c.setMessageObserver(new MessageObserver() {
             public void onMessage(Message message) {

Modified: incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java Mon Apr 16 08:42:53 2007
@@ -77,7 +77,7 @@
         ex.setInMessage(m);
 
         Conduit c = getLocalConduit("local://Echo");
-        m.setConduit(c);
+        ex.setConduit(c);
 
         c.setMessageObserver(new MessageObserver() {
             public void onMessage(Message message) {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Mon Apr 16 08:42:53 2007
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.endpoint;
 
-import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -33,7 +32,6 @@
 import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusException;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.common.i18n.UncheckedException;
@@ -41,12 +39,12 @@
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.interceptor.ClientOutFaultObserver;
-import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.phase.PhaseManager;
 import org.apache.cxf.service.Service;
@@ -59,8 +57,6 @@
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.ConduitInitiator;
-import org.apache.cxf.transport.ConduitInitiatorManager;
 import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
 
@@ -71,7 +67,7 @@
     
     protected Bus bus;
     protected Endpoint endpoint;
-    protected Conduit initedConduit;
+    protected ConduitSelector conduitSelector;
     protected ClientOutFaultObserver outFaultObserver; 
     protected int synchronousTimeout = 10000; // default 10 second timeout
 
@@ -84,7 +80,7 @@
         endpoint = e;
         outFaultObserver = new ClientOutFaultObserver(bus);
         if (null != c) {
-            initedConduit = c;
+            conduitSelector = new PreexistingConduitSelector(c);
         }
     }
 
@@ -111,7 +107,6 @@
             throw new IllegalStateException("Unable to create endpoint: " + epex.getMessage(), epex);
         }
     }
-    
 
     private EndpointInfo findEndpoint(Service svc, QName port) {
         EndpointInfo epfo;
@@ -203,7 +198,7 @@
         exchange.setOutMessage(message);
         
         setOutMessageProperties(message, oi);
-        setExchangeProperties(exchange, requestContext, oi);
+        setExchangeProperties(exchange, oi);
         
         // setup chain
 
@@ -212,24 +207,15 @@
         
         modifyChain(chain, requestContext);
         chain.setFaultObserver(outFaultObserver);
-        
-        if (requestContext != null 
-            && requestContext.containsKey(Message.ENDPOINT_ADDRESS)) {
-            endpoint.getEndpointInfo().setAddress((String)requestContext.get(Message.ENDPOINT_ADDRESS));
-        }
-        
-        
-        // setup conduit
-        Conduit conduit = getConduit();
-        exchange.setConduit(conduit);
-        conduit.setMessageObserver(this);
-        
-        //set clientImpl to exchange. used by jax-ws handlers
-        exchange.put(Client.class, this);
+                
+        // setup conduit selector
+        prepareConduitSelector(message);
         
         // execute chain
         chain.doIntercept(message);
 
+        getConduitSelector().complete(exchange);
+        
         // Check to see if there is a Fault from the outgoing chain
         Exception ex = message.getContent(Exception.class);
         
@@ -371,21 +357,17 @@
         }
     }
 
-    public Conduit getConduit() {        
-        if (null == initedConduit) {
-            EndpointInfo ei = endpoint.getEndpointInfo();
-            String transportID = ei.getTransportId();
-            try {
-                ConduitInitiator ci = bus.getExtension(ConduitInitiatorManager.class)
-                    .getConduitInitiator(transportID);
-                initedConduit = ci.getConduit(ei);
-            } catch (BusException ex) {
-                throw new Fault(ex);
-            } catch (IOException ex) {
-                throw new Fault(ex);
-            }
-        }
-        return initedConduit;
+    public Conduit getConduit() {
+        Message message = new MessageImpl();
+        Exchange exchange = new ExchangeImpl();
+        message.setExchange(exchange);
+        setExchangeProperties(exchange, null);
+        return getConduitSelector().selectConduit(message);
+    }
+
+    protected void prepareConduitSelector(Message message) {
+        getConduitSelector().prepare(message);
+        message.getExchange().put(ConduitSelector.class, getConduitSelector());
     }
 
     protected void setOutMessageProperties(Message message, BindingOperationInfo boi) {
@@ -396,17 +378,23 @@
     }
     
     protected void setExchangeProperties(Exchange exchange,
-                                         Map<String, Object> ctx,
                                          BindingOperationInfo boi) {
        
         exchange.put(Service.class, endpoint.getService());
         exchange.put(Endpoint.class, endpoint);
-        exchange.put(ServiceInfo.class, endpoint.getEndpointInfo().getService());
-        exchange.put(InterfaceInfo.class, endpoint.getEndpointInfo().getService().getInterface());
+        if (endpoint.getEndpointInfo().getService() != null) {
+            exchange.put(ServiceInfo.class, endpoint.getEndpointInfo().getService());
+            exchange.put(InterfaceInfo.class, endpoint.getEndpointInfo().getService().getInterface());
+        }
         exchange.put(Binding.class, endpoint.getBinding());
         exchange.put(BindingInfo.class, endpoint.getEndpointInfo().getBinding());
-        exchange.put(BindingOperationInfo.class, boi);
-        exchange.put(OperationInfo.class, boi.getOperationInfo());
+        if (boi != null) {
+            exchange.put(BindingOperationInfo.class, boi);
+            exchange.put(OperationInfo.class, boi.getOperationInfo());
+        }
+                
+        exchange.put(MessageObserver.class, this);
+        exchange.put(Bus.class, bus);
     }
 
     protected PhaseInterceptorChain setupInterceptorChain() { 
@@ -451,6 +439,17 @@
 
     public void setSynchronousTimeout(int synchronousTimeout) {
         this.synchronousTimeout = synchronousTimeout;
+    }
+    
+    public synchronized ConduitSelector getConduitSelector() {
+        if (null == conduitSelector) {
+            conduitSelector = new UpfrontConduitSelector();
+        }
+        return conduitSelector;
+    }
+
+    public void setConduitSelector(ConduitSelector selector) {
+        conduitSelector = selector;
     }
 
     private boolean isPartialResponse(Message in) {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java Mon Apr 16 08:42:53 2007
@@ -41,19 +41,8 @@
     }
 
     public void handleMessage(Message message) {
-        Exchange exchange = message.getExchange();
-        Conduit conduit =
-            message.getConduit() != null
-            ? message.getConduit()
-            : exchange.getConduit() != null
-              ? exchange.getConduit()
-              : (exchange.getOutMessage() != null
-                  || exchange.getOutFaultMessage() != null)
-                ? OutgoingChainInterceptor.getBackChannelConduit(exchange)
-                : null;
-
         try {
-            conduit.prepare(message);
+            getConduit(message).prepare(message);
         } catch (IOException ex) {
             throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_SEND", BUNDLE), ex);
         }    
@@ -69,18 +58,23 @@
         }
 
         public void handleMessage(Message message) throws Fault {
-            Exchange ex = message.getExchange();
-            Conduit endingConduit = 
-                message.getConduit() != null
-                ? message.getConduit() : ex.getConduit() != null
-                    ? ex.getConduit() : (ex.getOutMessage() != null || ex.getOutFaultMessage() != null)
-                        ? OutgoingChainInterceptor.getBackChannelConduit(ex) : null;
             try {
-                endingConduit.close(message);
+                getConduit(message).close(message);
             } catch (IOException e) {
                 throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_SEND", BUNDLE), e);
             }
         }
+    }
+    
+    private Conduit getConduit(Message message) {
+        Exchange exchange = message.getExchange();
+        Conduit conduit = exchange.getConduit(message);
+        if (conduit == null
+            && (exchange.getOutMessage() != null
+                || exchange.getOutFaultMessage() != null)) {
+            conduit = OutgoingChainInterceptor.getBackChannelConduit(message);
+        }
+        return conduit;
     }
 
 }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java Mon Apr 16 08:42:53 2007
@@ -26,7 +26,9 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.Binding;
+import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.PreexistingConduitSelector;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -54,7 +56,7 @@
         }
         Message out = ex.getOutMessage();
         if (out != null) {
-            getBackChannelConduit(ex);
+            getBackChannelConduit(message);
             if (bin != null) {
                 out.put(MessageInfo.class, bin.getOperationInfo().getOutput());
                 out.put(BindingMessageInfo.class, bin.getOutput());
@@ -69,15 +71,17 @@
         }
     }
     
-    protected static Conduit getBackChannelConduit(Exchange ex) {
+    protected static Conduit getBackChannelConduit(Message message) {
         Conduit conduit = null;
-        if (ex.getConduit() == null
+        Exchange ex = message.getExchange();
+        if (ex.getConduit(message) == null
             && ex.getDestination() != null) {
             try {
                 EndpointReferenceType target =
                     ex.get(EndpointReferenceType.class);
                 conduit = ex.getDestination().getBackChannel(ex.getInMessage(), null, target);
-                ex.setConduit(conduit);
+                ex.put(ConduitSelector.class, 
+                       new PreexistingConduitSelector(conduit));
             } catch (IOException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java Mon Apr 16 08:42:53 2007
@@ -72,4 +72,13 @@
     public void close() {
         // nothing to do by default
     }
+    
+    public String toString() {
+        return "conduit: " + this.getClass() + System.identityHashCode(this)
+               + "target: "
+               +  ((getTarget() != null
+                   && getTarget().getAddress() != null)
+                   ? getTarget().getAddress().getValue()
+                   : "null");
+    }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Mon Apr 16 08:42:53 2007
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.jaxws;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -38,9 +37,10 @@
 import javax.xml.ws.Service;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusException;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.UpfrontConduitSelector;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.jaxws.interceptors.DispatchInInterceptor;
 import org.apache.cxf.jaxws.interceptors.DispatchOutInterceptor;
@@ -51,10 +51,6 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.phase.PhaseManager;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.ConduitInitiator;
-import org.apache.cxf.transport.ConduitInitiatorManager;
 import org.apache.cxf.transport.MessageObserver;
 
 public class DispatchImpl<T> extends BindingProviderImpl implements Dispatch<T>, MessageObserver {
@@ -68,7 +64,8 @@
     private Service.Mode mode;
 
     private Endpoint endpoint;
-
+    private ConduitSelector conduitSelector;
+    
     DispatchImpl(Bus b, Service.Mode m, Class<T> clazz, Executor e, Endpoint ep) {
         super(((JaxWsEndpointImpl)ep).getJaxwsBinding());
         bus = b;
@@ -128,32 +125,29 @@
         ContextPropertiesMapping.mapRequestfromJaxws2Cxf(message);
         
         Exchange exchange = new ExchangeImpl();
-        exchange.put(Service.Mode.class, mode);
-        exchange.put(Class.class, cl);
-        exchange.put(org.apache.cxf.service.Service.class, endpoint.getService());
 
         exchange.setOutMessage(message);
-        message.setExchange(exchange);
+        setExchangeProperties(exchange);
 
         message.setContent(Object.class, obj);
 
         PhaseInterceptorChain chain = getDispatchOutChain();
         message.setInterceptorChain(chain);
 
-        // setup conduit
-        Conduit conduit = getConduit();
-        exchange.setConduit(conduit);
-        conduit.setMessageObserver(this);
-
+        // setup conduit selector
+        prepareConduitSelector(message);
+        
         // execute chain
         chain.doIntercept(message);
+        
+        getConduitSelector().complete(exchange);
                 
         if (message.getContent(Exception.class) != null) {
             throw new RuntimeException(message.getContent(Exception.class));
         }
 
         // correlate response        
-        if (conduit.getBackChannel() != null) {
+        if (getConduitSelector().selectConduit(message).getBackChannel() != null) {
             // process partial response and wait for decoupled response
         } else {
             // process response: send was synchronous so when we get here we can assume that the 
@@ -248,24 +242,6 @@
         }
     }
 
-    private Conduit getConduit() {
-        EndpointInfo ei = endpoint.getEndpointInfo();
-        String transportID = ei.getTransportId();
-        try {
-            ConduitInitiator ci = bus.getExtension(ConduitInitiatorManager.class)
-                .getConduitInitiator(transportID);
-            return ci.getConduit(ei);
-        } catch (BusException ex) {
-            // TODO: wrap in runtime exception
-            ex.printStackTrace();
-        } catch (IOException ex) {
-            // TODO: wrap in runtime exception
-            ex.printStackTrace();
-        }
-
-        return null;
-    }
-
     private Executor getExecutor() {
         if (executor == null) {
             executor = endpoint.getService().getExecutor();
@@ -297,4 +273,31 @@
     public void invokeOneWay(T obj) {
         invoke(obj, true);
     }
+        
+    public synchronized ConduitSelector getConduitSelector() {
+        if (null == conduitSelector) {
+            conduitSelector = new UpfrontConduitSelector();
+        }
+        return conduitSelector;
+    }
+
+    public void setConduitSelector(ConduitSelector selector) {
+        conduitSelector = selector;
+    }
+    
+    protected void prepareConduitSelector(Message message) {
+        getConduitSelector().prepare(message);
+        message.getExchange().put(ConduitSelector.class, getConduitSelector());
+    }
+    
+    protected void setExchangeProperties(Exchange exchange) {
+        exchange.put(Service.Mode.class, mode);
+        exchange.put(Class.class, cl);
+        exchange.put(org.apache.cxf.service.Service.class, endpoint.getService());
+        exchange.put(Endpoint.class, endpoint);
+        
+        exchange.put(MessageObserver.class, this);
+        exchange.put(Bus.class, bus);
+    }
+
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java Mon Apr 16 08:42:53 2007
@@ -24,11 +24,11 @@
 import javax.xml.transform.Source;
 import javax.xml.ws.Binding;
 
-import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.transport.MessageObserver;
 
 public class LogicalHandlerInterceptor<T extends Message> extends AbstractJAXWSHandlerInterceptor<T> {
 
@@ -55,13 +55,12 @@
                  * 3. set XMLSTreamReader to element inside Body
                  * OR
                  * message.setContent(Element.class, elementInBody);
-                 * 4. invoke Client.onMessage() starting after this.getID()
+                 * 4. invoke MessageObserver.onMessage() starting after this.getID()
                  */
-                Client client = (Client)message.getExchange().get(Client.class);
+                MessageObserver observer =
+                    (MessageObserver)message.getExchange().get(MessageObserver.class);
                 responseMsg.put(PhaseInterceptorChain.STARTING_AFTER_INTERCEPTOR_ID, this.getId());
-                if (client != null) {
-                    //message.getExchange().put(ClientImpl.FINISHED, Boolean.TRUE);
-                    //lctx.getMessage().getPayload();
+                if (observer != null) {
                     Source inSource = message.getContent(Source.class);
                     if (inSource != null) {
                         responseMsg.setContent(Source.class, inSource);
@@ -70,7 +69,7 @@
                     if (inObj != null) {
                         responseMsg.setContent(List.class, inObj);
                     }
-                    client.onMessage(responseMsg);
+                    observer.onMessage(responseMsg);
                 } else if (!message.getExchange().isOneWay()) {
                     //for the server side inbound
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd Mon Apr 16 08:42:53 2007
@@ -78,6 +78,7 @@
             <xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
+            <xsd:element name="conduitSelector" type="xsd:anyType" minOccurs="0"/>
           </xsd:sequence>
           <xsd:attribute name="address" type="xsd:string" />
           <xsd:attribute name="bindingUri" type="xsd:string" />

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java Mon Apr 16 08:42:53 2007
@@ -30,11 +30,11 @@
 import javax.xml.ws.handler.MessageContext;
 
 import junit.framework.TestCase;
-import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.transport.MessageObserver;
 import org.apache.handlers.types.AddNumbersResponse;
 import org.easymock.EasyMock;
 import org.easymock.classextension.IMocksControl;
@@ -124,9 +124,9 @@
         outMessage.setInterceptorChain(chain);
         chain.abort();
         EasyMock.expectLastCall();
-        Client client = control1.createMock(Client.class);
-        expect(exchange1.get(Client.class)).andReturn(client).anyTimes();
-        client.onMessage(isA(Message.class));
+        MessageObserver observer = control1.createMock(MessageObserver.class);
+        expect(exchange1.get(MessageObserver.class)).andReturn(observer).anyTimes();
+        observer.onMessage(isA(Message.class));
         EasyMock.expectLastCall();
 
         control1.replay();

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java Mon Apr 16 08:42:53 2007
@@ -29,6 +29,9 @@
 import org.apache.cxf.binding.soap.SoapBindingConfiguration;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.NullConduitSelector;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
@@ -142,8 +145,12 @@
         Object bean = ctx.getBean("client1.jaxwsProxyFactory");
         assertNotNull(bean);
         
-        Greeter c1 = (Greeter) ctx.getBean("client1");
-        assertNotNull(c1);
-
+        Greeter greeter = (Greeter) ctx.getBean("client1");
+        assertNotNull(greeter);
+        
+        Client client = ClientProxy.getClient(greeter);
+        assertNotNull("expected ConduitSelector", client.getConduitSelector());
+        assertTrue("unexpected ConduitSelector",
+                   client.getConduitSelector() instanceof NullConduitSelector);
     }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml Mon Apr 16 08:42:53 2007
@@ -43,7 +43,11 @@
     serviceClass="org.apache.hello_world_soap_http.Greeter"
     address="http://localhost:9000/foo"
     serviceName="s:SOAPService"
-    xmlns:s="http://apache.org/hello_world_soap_http"/>
+    xmlns:s="http://apache.org/hello_world_soap_http">
+    <jaxws:conduitSelector>
+      <bean class="org.apache.cxf.endpoint.NullConduitSelector"/>
+    </jaxws:conduitSelector>
+  </jaxws:client>
     
 <!--
   

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java Mon Apr 16 08:42:53 2007
@@ -33,6 +33,7 @@
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
@@ -62,6 +63,7 @@
     private Map<String, Object> properties;
     private List<AbstractWSFeature> features;
     private BindingConfiguration bindingConfig;
+    private ConduitSelector conduitSelector;
     
     protected Endpoint createEndpoint() throws BusException, EndpointException {
         Service service = serviceFactory.getService();
@@ -333,4 +335,11 @@
         getServiceFactory().setWsdlURL(wsdlURL);
     }
     
+    public ConduitSelector getConduitSelector() {
+        return conduitSelector;
+    }
+
+    public void setConduitSelector(ConduitSelector selector) {
+        conduitSelector = selector;
+    }
 }

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java Mon Apr 16 08:42:53 2007
@@ -57,6 +57,7 @@
 
     protected void createClient(Endpoint ep) {
         client = new ClientImpl(getBus(), ep);
+        client.setConduitSelector(getConduitSelector());
     }
 
     protected void applyFeatures() {

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java Mon Apr 16 08:42:53 2007
@@ -27,6 +27,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 
@@ -155,6 +156,14 @@
 
     public void setAddress(String add) {
         clientFactoryBean.setAddress(add);
+    }
+
+    public ConduitSelector getConduitSelector() {
+        return clientFactoryBean.getConduitSelector();
+    }
+
+    public void setConduitSelector(ConduitSelector selector) {
+        clientFactoryBean.setConduitSelector(selector);
     }
 
     public ReflectionServiceFactoryBean getServiceFactory() {

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java Mon Apr 16 08:42:53 2007
@@ -67,7 +67,7 @@
         ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
         ConduitInitiator ci = cim.getConduitInitiator("http://schemas.xmlsoap.org/soap/http");
         HTTPConduit conduit = (HTTPConduit) ci.getConduit(info);
-        assertEquals(97, conduit.getClient().getConnectionTimeout(), 0);
+        assertEquals(97, conduit.getClient().getConnectionTimeout());
         
     }
 }

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Mon Apr 16 08:42:53 2007
@@ -38,7 +38,10 @@
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PackageUtils;
+import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.NullConduitSelector;
+import org.apache.cxf.endpoint.PreexistingConduitSelector;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.interceptor.OutgoingChainInterceptor;
@@ -340,6 +343,7 @@
                 Conduit backChannel = target.getBackChannel(inMessage,
                                                             partialResponse,
                                                             reference);
+
                 if (backChannel != null) {
                     // set up interceptor chains and send message
                     InterceptorChain chain =
@@ -347,8 +351,9 @@
                         ? fullResponse.getInterceptorChain()
                         : OutgoingChainInterceptor.getOutInterceptorChain(exchange);
                     partialResponse.setInterceptorChain(chain);
-                    exchange.setConduit(backChannel);
-                    
+                    exchange.put(ConduitSelector.class,
+                                 new PreexistingConduitSelector(backChannel));
+
                     if (!partialResponse.getInterceptorChain().doIntercept(partialResponse) 
                             && partialResponse.getContent(Exception.class) != null) {
                         if (partialResponse.getContent(Exception.class) instanceof Fault) {
@@ -359,7 +364,7 @@
                     }
                     
                     partialResponse.getInterceptorChain().reset();
-                    exchange.setConduit(null);
+                    exchange.put(ConduitSelector.class, new NullConduitSelector());
                     if (fullResponse != null) {
                         exchange.setOutMessage(fullResponse);
                     } else {
@@ -594,7 +599,7 @@
     public static Conduit getConduit(Conduit conduit, Message message) {
         if (conduit == null) {
             Exchange exchange = message.getExchange();
-            conduit = exchange != null ? exchange.getConduit() : null;
+            conduit = exchange != null ? exchange.getConduit(message) : null;
         }
         return conduit;
     }

Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java Mon Apr 16 08:42:53 2007
@@ -576,7 +576,7 @@
     private void setUpConduit(Message message, Exchange exchange) {
         setUpMessageExchange(message, exchange);        
         Conduit conduit = EasyMock.createMock(Conduit.class);
-        setUpExchangeConduit(exchange, conduit);
+        setUpExchangeConduit(message, exchange, conduit);
         EndpointReferenceType to =
             ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType();
         to.setAddress(ContextUtils.getAttributedURI(expectedTo));
@@ -653,8 +653,10 @@
         //exchange.setOutMessage(outbound ? message : new MessageImpl());
     }
 
-    private void setUpExchangeConduit(Exchange exchange, Conduit conduit) {
-        exchange.getConduit();
+    private void setUpExchangeConduit(Message message,
+                                      Exchange exchange,
+                                      Conduit conduit) {
+        exchange.getConduit(message);
         EasyMock.expectLastCall().andReturn(conduit);
         //exchange.setConduit(conduit);
     }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AbstractPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AbstractPolicyInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AbstractPolicyInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AbstractPolicyInterceptor.java Mon Apr 16 08:42:53 2007
@@ -55,7 +55,7 @@
     protected void getTransportAssertions(Message message) {
         Exchange ex = message.getExchange();
         Assertor assertor = null;
-        Conduit conduit = ex.getConduit();
+        Conduit conduit = ex.getConduit(message);
         if (conduit instanceof Assertor) {
             assertor = (Assertor)conduit;
         } else {

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java Mon Apr 16 08:42:53 2007
@@ -68,7 +68,7 @@
             return;
         }
         
-        Conduit conduit = exchange.getConduit();
+        Conduit conduit = exchange.getConduit(msg);
         LOG.fine("conduit: " + conduit);
         
         // We do not know the underlying message type yet - so we pre-emptively add interceptors 

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java Mon Apr 16 08:42:53 2007
@@ -68,7 +68,7 @@
             return;
         }
         
-        Conduit conduit = exchange.getConduit();
+        Conduit conduit = exchange.getConduit(msg);
         
         // We do not know the underlying message type yet - so we pre-emptively add interceptors 
         // that can deal with any resposes or faults returned to this client endpoint.

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java Mon Apr 16 08:42:53 2007
@@ -75,7 +75,7 @@
             return;
         }
         
-        Conduit conduit = exchange.getConduit();
+        Conduit conduit = exchange.getConduit(msg);
         
         // add the required interceptors
         

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java Mon Apr 16 08:42:53 2007
@@ -355,7 +355,7 @@
             
         if (isClient) {
             conduit = control.createMock(Conduit.class);
-            EasyMock.expect(exchange.getConduit()).andReturn(conduit);
+            EasyMock.expect(exchange.getConduit(message)).andReturn(conduit);
         } else {
             destination = control.createMock(Destination.class);
             EasyMock.expect(exchange.getDestination()).andReturn(destination);

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java Mon Apr 16 08:42:53 2007
@@ -31,6 +31,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientImpl;
+import org.apache.cxf.endpoint.DeferredConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.BindingInfo;
@@ -209,32 +210,33 @@
 
         RMClient(Bus bus, Endpoint endpoint, Conduit conduit,
             org.apache.cxf.ws.addressing.EndpointReferenceType a) {
-            super(bus, endpoint, conduit);  
+            super(bus, endpoint);  
             address = a;
+            setConduitSelector(new DeferredConduitSelector(conduit) {
+                @Override
+                public Conduit selectConduit(Message message) {
+                    Conduit conduit = null;
+                    EndpointInfo endpointInfo = getEndpoint().getEndpointInfo();
+                    String originalAddress = endpointInfo.getAddress();
+                    try {
+                        if (null != address) {
+                            endpointInfo.setAddress(address.getAddress().getValue());
+                        }
+                        conduit = super.selectConduit(message);
+                    } finally {
+                        endpointInfo.setAddress(originalAddress);
+                    }
+                    return conduit;
+                }
+            });
+
         }
 
         @Override
         public void onMessage(Message m) {
-            // TODO Auto-generated method stub
             m.getExchange().put(Endpoint.class, Proxy.this.reliableEndpoint.getApplicationEndpoint());
             super.onMessage(m);
         }    
-
-        @Override
-        public Conduit getConduit() {
-            Conduit conduit = null;
-            EndpointInfo endpointInfo = endpoint.getEndpointInfo();
-            String originalAddress = endpointInfo.getAddress();
-            try {
-                if (null != address) {
-                    endpointInfo.setAddress(address.getAddress().getValue());
-                }
-                conduit = super.getConduit();
-            } finally {
-                endpointInfo.setAddress(originalAddress);
-            }
-            return conduit;
-        }
     }
     
     // for test

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Mon Apr 16 08:42:53 2007
@@ -119,7 +119,7 @@
                 AddressingPropertiesImpl maps = RMContextUtils.retrieveMAPs(message, false, false);
                 replyTo = maps.getReplyTo();
             } 
-            rme.initialise(message.getExchange().getConduit(), replyTo);
+            rme.initialise(message.getExchange().getConduit(message), replyTo);
             reliableEndpoints.put(endpoint, rme); 
             LOG.fine("Created new RMEndpoint.");
         }
@@ -175,7 +175,7 @@
                     acksTo = VersionTransformer.convert(maps.getReplyTo()); 
                     if (RMConstants.getNoneAddress().equals(acksTo.getAddress().getValue())) {
                         org.apache.cxf.transport.Destination dest = message.getExchange()
-                            .getConduit().getBackChannel();
+                            .getConduit(message).getBackChannel();
                         if (null == dest) {
                             acksTo = RMUtils.createAnonymousReference2004();
                         } else {

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java Mon Apr 16 08:42:53 2007
@@ -275,7 +275,7 @@
     }
 
     private void clientResend(Message message) {
-        Conduit c = message.getExchange().getConduit();
+        Conduit c = message.getExchange().getConduit(message);
         try {
 
             // get registered callbacks, create new output stream and

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java Mon Apr 16 08:42:53 2007
@@ -247,7 +247,7 @@
             control.createMock(org.apache.cxf.ws.addressing.EndpointReferenceType.class);
         Proxy.RMClient client = proxy.new RMClient(bus, endpoint, conduit, address);
         EndpointInfo endpointInfo = control.createMock(EndpointInfo.class);
-        EasyMock.expect(endpoint.getEndpointInfo()).andReturn(endpointInfo);
+        EasyMock.expect(endpoint.getEndpointInfo()).andReturn(endpointInfo).anyTimes();
         String oa = "oa";
         EasyMock.expect(endpointInfo.getAddress()).andReturn(oa);
         AttributedURIType uri = control.createMock(AttributedURIType.class);

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java Mon Apr 16 08:42:53 2007
@@ -200,7 +200,7 @@
         EasyMock.expect(exchange.getInMessage()).andReturn(null).anyTimes();
         EasyMock.expect(exchange.getOutFaultMessage()).andReturn(null).anyTimes();
         Conduit conduit = control.createMock(Conduit.class);
-        EasyMock.expect(exchange.getConduit()).andReturn(conduit).anyTimes();
+        EasyMock.expect(exchange.getConduit(message)).andReturn(conduit).anyTimes();
         EasyMock.expect(conduit.getBackChannel()).andReturn(null).anyTimes();
         Identifier inSid = control.createMock(Identifier.class);        
         AddressingProperties maps = control.createMock(AddressingProperties.class);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Mon Apr 16 08:42:53 2007
@@ -50,6 +50,7 @@
 //import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.helpers.XPathUtils;
+import org.apache.cxf.interceptor.Fault;
 //import org.apache.cxf.jaxws.ServiceImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -690,23 +691,34 @@
         }
     }
     
-    
+
     @Test
+    @Ignore
     public void testBogusAddress() throws Exception {
+        String realAddress = "http://localhost:9015/SoapContext/SoapPort";
         Service service = Service.create(bogusAddressServiceName);
         Greeter greeter = service.getPort(portName, Greeter.class);
         BindingProvider bp = (BindingProvider)greeter;
         bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-                                   "http://localhost:9015/SoapContext/SoapPort");
-                                   
+                                   realAddress);
         greeter.greetMe("test");
+
+        try {
+            greeter.greetMe("test");
+            fail("expected address override not to persist beyond a single invocation");
+        } catch (Fault f) {
+            // expected
+        }
+
+        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                                   realAddress);
         String reply = greeter.sayHi();
         assertNotNull("no response received from service", reply);
         assertEquals("Bonjour", reply);
                                    
     }
     
-    @Test   
+    @Test
     public void testDynamicClientFactory()  {
         URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
         assertNotNull(wsdl);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml Mon Apr 16 08:42:53 2007
@@ -20,6 +20,7 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
+       xmlns:jaxws="http://cxf.apache.org/jaxws"
        xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
   
@@ -56,6 +57,13 @@
             </list>
         </property>
     </bean>
+
+    <jaxws:client id="{http://apache.org/hello_world_soap_http}SoapPort" 
+                  abstract="true">
+        <jaxws:conduitSelector>
+            <bean class="org.apache.cxf.endpoint.DeferredConduitSelector"/>
+        </jaxws:conduitSelector>
+    </jaxws:client>
     
     <!-- Configuring the service level interceptors would work also but is not as convenient
          as we have to remember to include the default interceptors. -->

Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl?view=diff&rev=529292&r1=529291&r2=529292
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl (original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl Mon Apr 16 08:42:53 2007
@@ -392,7 +392,7 @@
     </wsdl:service>
     <wsdl:service name="SOAPServiceBogusAddressTest">
         <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
-            <soap:address location="FOO"/>
+            <soap:address location="http://nowhere.nada.nil:45678/null/never"/>
         </wsdl:port>
     </wsdl:service>
     <wsdl:service name="SOAPServiceMultiPortTypeTest">



Mime
View raw message