cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r823468 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
Date Fri, 09 Oct 2009 08:59:53 GMT
Author: sergeyb
Date: Fri Oct  9 08:59:52 2009
New Revision: 823468

URL: http://svn.apache.org/viewvc?rev=823468&view=rev
Log:
Merged revisions 823456 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r823456 | sergeyb | 2009-10-09 09:44:21 +0100 (Fri, 09 Oct 2009) | 1 line
  
  [CXF-2320] : updating AbstractClient to retry with a default ConduitInitiator when no ConduitInitiator
can be found (ex in SMX JBI contexts)
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:823456

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=823468&r1=823467&r2=823468&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
Fri Oct  9 08:59:52 2009
@@ -47,10 +47,12 @@
 import javax.ws.rs.ext.MessageBodyWriter;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.jaxrs.impl.UriBuilderImpl;
@@ -65,7 +67,9 @@
 import org.apache.cxf.phase.PhaseChainCache;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.phase.PhaseManager;
+import org.apache.cxf.transport.ConduitInitiatorManager;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory;
 
 /**
  * Common proxy and http-centric client implementation
@@ -487,7 +491,24 @@
     }
     
     protected void prepareConduitSelector(Message message) {
-        cfg.getConduitSelector().prepare(message);
+        try {
+            cfg.getConduitSelector().prepare(message);
+        } catch (Fault ex) {
+            LOG.fine("Failure to prepare a message from conduit selector");
+            if (ex.getCause() instanceof BusException) {
+                String code = ((BusException)ex.getCause()).getCode();
+                if ("NO_CONDUIT_INITIATOR".equals(code)) {
+                    ConduitInitiatorManager cim = cfg.getBus().getExtension(ConduitInitiatorManager.class);
+                    ClientOnlyHTTPTransportFactory factory = new ClientOnlyHTTPTransportFactory();
+                    factory.setBus(cfg.getBus());                   
+                    cim.registerConduitInitiator(
+                        cfg.getConduitSelector().getEndpoint().getEndpointInfo().getTransportId(),
factory);
+                    cfg.getConduitSelector().prepare(message);
+                } else {
+                    throw ex;
+                }
+            }
+        }
         message.getExchange().put(ConduitSelector.class, cfg.getConduitSelector());
     }
     



Mime
View raw message