Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B53621048D for ; Fri, 9 Jan 2015 17:27:29 +0000 (UTC) Received: (qmail 25629 invoked by uid 500); 9 Jan 2015 17:27:31 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 25570 invoked by uid 500); 9 Jan 2015 17:27:31 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 25561 invoked by uid 99); 9 Jan 2015 17:27:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jan 2015 17:27:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C353881685B; Fri, 9 Jan 2015 17:27:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dkulp@apache.org To: commits@cxf.apache.org Message-Id: <666c04fb9255468098ebfd8e151f7406@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: [CXF-6188] Add ability to configure the builder and provide a Registry of AuthSchemeProviders Date: Fri, 9 Jan 2015 17:27:30 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/master d5b502a60 -> eb82c4c12 [CXF-6188] Add ability to configure the builder and provide a Registry of AuthSchemeProviders Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/eb82c4c1 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/eb82c4c1 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/eb82c4c1 Branch: refs/heads/master Commit: eb82c4c12f2613379dafa48763a30ccd5efc4861 Parents: d5b502a Author: Daniel Kulp Authored: Fri Jan 9 12:26:38 2015 -0500 Committer: Daniel Kulp Committed: Fri Jan 9 12:26:38 2015 -0500 ---------------------------------------------------------------------- .../transport/http/asyncclient/AsyncHTTPConduit.java | 8 ++++++++ .../http/asyncclient/AsyncHTTPConduitFactory.java | 14 +++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/eb82c4c1/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java ---------------------------------------------------------------------- diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java index 56a677b..77815fa 100644 --- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java +++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java @@ -72,6 +72,7 @@ import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.http.Header; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; +import org.apache.http.auth.AuthSchemeProvider; import org.apache.http.auth.AuthScope; import org.apache.http.auth.Credentials; import org.apache.http.auth.UsernamePasswordCredentials; @@ -79,6 +80,7 @@ import org.apache.http.client.config.RequestConfig; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.concurrent.BasicFuture; import org.apache.http.concurrent.FutureCallback; +import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.BasicCredentialsProvider; @@ -550,6 +552,12 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit { credsProvider.setCredentials(AuthScope.ANY, creds); ctx.setUserToken(creds.getUserPrincipal()); } + @SuppressWarnings("unchecked") + Registry asp = (Registry)outMessage + .getContextualProperty(AuthSchemeProvider.class.getName()); + if (asp != null) { + ctx.setAuthSchemeRegistry(asp); + } c.execute(new CXFHttpAsyncRequestProducer(entity, outbuf), new CXFHttpAsyncResponseConsumer(this, inbuf, responseCallback), http://git-wip-us.apache.org/repos/asf/cxf/blob/eb82c4c1/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java ---------------------------------------------------------------------- diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java index c8411c9..6158d44 100644 --- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java +++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java @@ -47,6 +47,7 @@ import org.apache.http.impl.client.BasicCookieStore; import org.apache.http.impl.conn.DefaultSchemePortResolver; import org.apache.http.impl.conn.SystemDefaultDnsResolver; import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; +import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; import org.apache.http.impl.nio.client.HttpAsyncClients; import org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionFactory; import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager; @@ -349,19 +350,26 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory { } }; - client = HttpAsyncClients.custom() + HttpAsyncClientBuilder httpAsyncClientBuilder = HttpAsyncClients.custom() .setConnectionManager(connectionManager) .setRedirectStrategy(redirectStrategy) .setDefaultCookieStore(new BasicCookieStore() { private static final long serialVersionUID = 1L; public void addCookie(Cookie cookie) { } - }) - .build(); + }); + + adaptClientBuilder(httpAsyncClientBuilder); + + client = httpAsyncClientBuilder.build(); // Start the client thread client.start(); } + //provide a hook to customize the builder + protected void adaptClientBuilder(HttpAsyncClientBuilder httpAsyncClientBuilder) { + } + public CloseableHttpAsyncClient createClient(final AsyncHTTPConduit c) throws IOException { if (client == null) { setupNIOClient(c.getClient());