cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1413768 - /cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
Date Mon, 26 Nov 2012 18:24:06 GMT
Author: dkulp
Date: Mon Nov 26 18:24:05 2012
New Revision: 1413768

URL: http://svn.apache.org/viewvc?rev=1413768&view=rev
Log:
[CXF-4645] Allow re-use of connections when Auth is specifically set
Modified patch from Øystein Grimstad applied

Modified:
    cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java

Modified: cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java?rev=1413768&r1=1413767&r2=1413768&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
(original)
+++ cxf/trunk/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
Mon Nov 26 18:24:05 2012
@@ -469,10 +469,16 @@ public class AsyncHTTPConduit extends UR
             ctx.setAttribute(ClientContext.SCHEME_REGISTRY, reg);
             connectionFuture = new BasicFuture<Boolean>(callback);
             DefaultHttpAsyncClient c = getHttpAsyncClient();
+            CredentialsProvider credProvider = c.getCredentialsProvider();
             Credentials creds = (Credentials)outMessage.getContextualProperty(Credentials.class.getName());
-            if (creds != null) {
-                c.getCredentialsProvider().setCredentials(AuthScope.ANY, creds);
+            if (creds != null && credProvider != null) {
+                credProvider.setCredentials(AuthScope.ANY, creds);
             }
+            if (credProvider != null && credProvider.getCredentials(AuthScope.ANY)
!= null) {
+                ctx.setAttribute(ClientContext.USER_TOKEN,
+                                 credProvider.getCredentials(AuthScope.ANY).getUserPrincipal());
+            }
+            
             c.execute(new CXFHttpAsyncRequestProducer(entity, outbuf),
                       new CXFHttpAsyncResponseConsumer(this, inbuf, responseCallback),
                       ctx,



Mime
View raw message