shindig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lind...@apache.org
Subject svn commit: r1224708 - /shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
Date Mon, 26 Dec 2011 10:44:42 GMT
Author: lindner
Date: Mon Dec 26 10:44:42 2011
New Revision: 1224708

URL: http://svn.apache.org/viewvc?rev=1224708&view=rev
Log:
fix deprecated usage for httpclient

Modified:
    shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java

Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java?rev=1224708&r1=1224707&r2=1224708&view=diff
==============================================================================
--- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
(original)
+++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
Mon Dec 26 10:44:42 2011
@@ -48,8 +48,10 @@ import org.apache.http.client.params.Cli
 import org.apache.http.client.params.HttpClientParams;
 import org.apache.http.client.protocol.RequestAddCookies;
 import org.apache.http.client.protocol.ResponseProcessCookies;
+import org.apache.http.conn.ClientConnectionManager;
 import org.apache.http.conn.ConnectionPoolTimeoutException;
 import org.apache.http.conn.HttpHostConnectException;
+import org.apache.http.conn.params.ConnManagerParams;
 import org.apache.http.conn.params.ConnPerRouteBean;
 import org.apache.http.conn.params.ConnRouteParams;
 import org.apache.http.conn.scheme.PlainSocketFactory;
@@ -150,7 +152,11 @@ public class BasicHttpFetcher implements
 
     HttpParams params = new BasicHttpParams();
 
-    HttpConnectionParams.setConnectionTimeout(params, connectionTimeoutMs);
+    ConnManagerParams.setTimeout(params, connectionTimeoutMs);
+
+    // These are probably overkill for most sites.
+    ConnManagerParams.setMaxTotalConnections(params, 1152);
+    ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(256));
 
     HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
     HttpProtocolParams.setUserAgent(params, "Apache Shindig");
@@ -166,14 +172,10 @@ public class BasicHttpFetcher implements
 
     // Create and initialize scheme registry
     SchemeRegistry schemeRegistry = new SchemeRegistry();
-    schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
-    schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
-
-    ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(schemeRegistry);
-    // These are probably overkill for most sites.
-    cm.setMaxTotal(1152);
-    cm.setDefaultMaxPerRoute(256);
+    schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
+    schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
 
+    ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
     DefaultHttpClient client = new DefaultHttpClient(cm, params);
 
     // Set proxy if set via guice.



Mime
View raw message