cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6498] Updating 2.0 ClientImpl to accept CXF features
Date Wed, 15 Jul 2015 09:01:47 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 5dbd6cb35 -> 90de43b2c


[CXF-6498] Updating 2.0 ClientImpl to accept CXF features


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/90de43b2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/90de43b2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/90de43b2

Branch: refs/heads/3.0.x-fixes
Commit: 90de43b2c01375ac8493c61bb00723fe2b17eaa9
Parents: 5dbd6cb
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Jul 15 11:59:52 2015 +0300
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Jul 15 12:01:26 2015 +0300

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/client/spec/ClientImpl.java   | 13 ++++++++++---
 .../systest/jaxrs/security/JAXRS20HttpsBookTest.java   |  2 ++
 2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/90de43b2/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
index fa68058..b15d730 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
@@ -248,9 +248,13 @@ public class ClientImpl implements Client {
             ClientProviderFactory pf = 
                 ClientProviderFactory.getInstance(WebClient.getConfig(targetClient).getEndpoint());
             List<Object> providers = new LinkedList<Object>();
+            List<org.apache.cxf.feature.Feature> cxfFeatures = 
+                new LinkedList<org.apache.cxf.feature.Feature>();
             Configuration cfg = configImpl.getConfiguration();
             for (Object p : cfg.getInstances()) {
-                if (!(p instanceof Feature)) {
+                if (p instanceof org.apache.cxf.feature.Feature) {
+                    cxfFeatures.add((org.apache.cxf.feature.Feature)p);
+                } else if (!(p instanceof Feature)) {
                     Map<Class<?>, Integer> contracts = cfg.getContracts(p.getClass());
                     if (contracts == null || contracts.isEmpty()) {
                         providers.add(p);
@@ -277,8 +281,11 @@ public class ClientImpl implements Client {
             }
             
             setConnectionProperties(configProps, clientCfg);
-            
-            // start building the invocation
+            // CXF Features
+            for (org.apache.cxf.feature.Feature cxfFeature : cxfFeatures) {
+                cxfFeature.initialize(clientCfg, clientCfg.getBus());
+            }
+            // Start building the invocation
             return new InvocationBuilderImpl(WebClient.fromClient(targetClient));
         }
         private void setConnectionProperties(Map<String, Object> configProps, ClientConfiguration
clientCfg) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/90de43b2/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRS20HttpsBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRS20HttpsBookTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRS20HttpsBookTest.java
index 87fdd62..30fee8b 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRS20HttpsBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRS20HttpsBookTest.java
@@ -31,6 +31,7 @@ import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.MediaType;
 
 import org.apache.cxf.configuration.jsse.TLSClientParameters;
+import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.systest.jaxrs.Book;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.transport.https.CertificateHostnameVerifier;
@@ -65,6 +66,7 @@ public class JAXRS20HttpsBookTest extends AbstractBusClientServerTestBase
{
         builder.keyStore(keyStore, "password");
         
         Client client = builder.build();
+        client.register(new LoggingFeature());
         
         WebTarget target = client.target("https://localhost:" + PORT + "/bookstore/securebooks/123");
         Book b = target.request().accept(MediaType.APPLICATION_XML_TYPE).get(Book.class);


Mime
View raw message