abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r570168 - /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
Date Mon, 27 Aug 2007 16:00:10 GMT
Author: jmsnell
Date: Mon Aug 27 09:00:09 2007
New Revision: 570168

URL: http://svn.apache.org/viewvc?rev=570168&view=rev
Log:
Support for setting proxy server settings

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java?rev=570168&r1=570167&r2=570168&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
Mon Aug 27 09:00:09 2007
@@ -526,4 +526,44 @@
       HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS,
       MultiThreadedHttpConnectionManager.DEFAULT_MAX_TOTAL_CONNECTIONS);
   }
+  
+  /**
+   * Configure the client to use the specified proxy
+   */
+  public void setProxy(
+    String host, 
+    int port) {
+      client.getHostConfiguration().setProxy(host, port);
+  }
+  
+  /**
+   * Specify the auth credentials for the proxy server
+   */
+  public void setProxyCredentials(
+      String host,
+      int port,
+      Credentials credentials) {
+    setProxyCredentials(host,port,null,null,credentials);
+  }
+  
+  /**
+   * Specify the auth credentials for the proxy server
+   */
+  public void setProxyCredentials(
+    String host,
+    int port,
+    String realm,
+    String scheme,
+    Credentials credentials) {
+      host = host != null ? host : AuthScope.ANY_HOST;
+      port = port > -1 ? port : AuthScope.ANY_PORT;
+      AuthScope scope = 
+        new AuthScope(
+          host, 
+          port, 
+          realm != null ? realm : AuthScope.ANY_REALM, 
+          scheme != null ? scheme : AuthScope.ANY_SCHEME);
+      client.getState().setProxyCredentials(
+        scope, credentials);
+  }
 }



Mime
View raw message