incubator-droids-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1405049 - /incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/http/DroidsHttpClient.java
Date Fri, 02 Nov 2012 16:56:06 GMT
Author: tobr
Date: Fri Nov  2 16:56:06 2012
New Revision: 1405049

URL: http://svn.apache.org/viewvc?rev=1405049&view=rev
Log:
changed HTTPRoutePlanner to ProxySelectorRoutePlanner to support JVM Proxy Settings
removed overrides containing the super implementation defaults

Modified:
    incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/http/DroidsHttpClient.java

Modified: incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/http/DroidsHttpClient.java
URL: http://svn.apache.org/viewvc/incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/http/DroidsHttpClient.java?rev=1405049&r1=1405048&r2=1405049&view=diff
==============================================================================
--- incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/http/DroidsHttpClient.java
(original)
+++ incubator/droids/trunk/droids-core/src/main/java/org/apache/droids/protocol/http/DroidsHttpClient.java
Fri Nov  2 16:56:06 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.droids.protocol.http;
 
+import java.net.ProxySelector;
+
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpVersion;
 import org.apache.http.auth.AuthSchemeRegistry;
@@ -49,6 +51,7 @@ import org.apache.http.impl.client.Defau
 import org.apache.http.impl.client.DefaultRedirectHandler;
 import org.apache.http.impl.client.DefaultUserTokenHandler;
 import org.apache.http.impl.conn.DefaultHttpRoutePlanner;
+import org.apache.http.impl.conn.ProxySelectorRoutePlanner;
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.CoreProtocolPNames;
@@ -98,7 +101,7 @@ public class DroidsHttpClient extends Ab
     params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 20000);
     params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 20000);
     params.setParameter(CoreConnectionPNames.TCP_NODELAY, false);
-    params.setLongParameter(MAX_BODY_LENGTH, 512 * 1024);
+    //params.setLongParameter(MAX_BODY_LENGTH, 512 * 1024);
     return params;
   }
 
@@ -129,18 +132,6 @@ public class DroidsHttpClient extends Ab
   }
 
   @Override
-  protected ConnectionKeepAliveStrategy createConnectionKeepAliveStrategy()
-  {
-    return new DefaultConnectionKeepAliveStrategy();
-  }
-
-  @Override
-  protected ConnectionReuseStrategy createConnectionReuseStrategy()
-  {
-    return new DefaultConnectionReuseStrategy();
-  }
-
-  @Override
   protected AuthSchemeRegistry createAuthSchemeRegistry()
   {
     AuthSchemeRegistry registry = new AuthSchemeRegistry(); 
@@ -160,17 +151,6 @@ public class DroidsHttpClient extends Ab
     return new CookieSpecRegistry();
   }
 
-  @Override
-  protected CookieStore createCookieStore()
-  {
-    return new BasicCookieStore();
-  }
-
-  @Override
-  protected CredentialsProvider createCredentialsProvider()
-  {
-    return new BasicCredentialsProvider();
-  }
 
   @Override
   protected HttpContext createHttpContext()
@@ -191,16 +171,15 @@ public class DroidsHttpClient extends Ab
     return new DroidsRequestRetryHandler();
   }
 
+  /**
+   * Added ProxySelectorRoutePlanner to support JVM Proxy Settings
+   */
   @Override
   protected HttpRoutePlanner createHttpRoutePlanner()
   {
-    return new DefaultHttpRoutePlanner(getConnectionManager().getSchemeRegistry());
-  }
-
-  @Override
-  protected AuthenticationHandler createProxyAuthenticationHandler()
-  {
-    return new DefaultProxyAuthenticationHandler();
+    return new ProxySelectorRoutePlanner(
+	        this.getConnectionManager().getSchemeRegistry(),
+	        ProxySelector.getDefault());  
   }
 
   @Override
@@ -209,22 +188,4 @@ public class DroidsHttpClient extends Ab
     return new NoAuthHandler();
   }
 
-  @Override
-  protected RedirectHandler createRedirectHandler()
-  {
-    return new DefaultRedirectHandler();
-  }
-
-  @Override
-  protected HttpRequestExecutor createRequestExecutor()
-  {
-    return new HttpRequestExecutor();
-  }
-
-  @Override
-  protected UserTokenHandler createUserTokenHandler()
-  {
-    return new DefaultUserTokenHandler();
-  }
-
 }



Mime
View raw message