hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1604773 - in /httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent: Executor.java Request.java
Date Mon, 23 Jun 2014 12:13:52 GMT
Author: olegk
Date: Mon Jun 23 12:13:52 2014
New Revision: 1604773

URL: http://svn.apache.org/r1604773
Log:
HTTPCLIENT-1480: convenience methods for HC fluent to set auth hosts

Modified:
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
    httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java?rev=1604773&r1=1604772&r2=1604773&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
(original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
Mon Jun 23 12:13:52 2014
@@ -130,6 +130,13 @@ public class Executor {
         return auth(authScope, creds);
     }
 
+    /**
+     * @since 4.4
+     */
+    public Executor auth(final String host, final Credentials creds) {
+        return auth(HttpHost.create(host), creds);
+    }
+
     public Executor authPreemptive(final HttpHost host) {
         final BasicScheme basicScheme = new BasicScheme();
         try {
@@ -140,16 +147,30 @@ public class Executor {
         return this;
     }
 
-    public Executor authPreemptiveProxy(final HttpHost host) {
+    /**
+     * @since 4.4
+     */
+    public Executor authPreemptive(final String host) {
+        return authPreemptive(HttpHost.create(host));
+    }
+
+    public Executor authPreemptiveProxy(final HttpHost proxy) {
         final BasicScheme basicScheme = new BasicScheme();
         try {
             basicScheme.processChallenge(new BasicHeader(AUTH.PROXY_AUTH, "BASIC "));
         } catch (final MalformedChallengeException ignore) {
         }
-        this.authCache.put(host, basicScheme);
+        this.authCache.put(proxy, basicScheme);
         return this;
     }
 
+    /**
+     * @since 4.4
+     */
+    public Executor authPreemptiveProxy(final String proxy) {
+        return authPreemptiveProxy(HttpHost.create(proxy));
+    }
+
     public Executor auth(final Credentials cred) {
         return auth(AuthScope.ANY, cred);
     }

Modified: httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java?rev=1604773&r1=1604772&r2=1604773&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
(original)
+++ httpcomponents/httpclient/trunk/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
Mon Jun 23 12:13:52 2014
@@ -294,6 +294,14 @@ public class Request {
         return this;
     }
 
+    /**
+     * @since 4.4
+     */
+    public Request viaProxy(final String proxy) {
+        this.configBuilder.setProxy(HttpHost.create(proxy));
+        return this;
+    }
+
     //// HTTP entity operations
 
     public Request body(final HttpEntity entity) {



Mime
View raw message