hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r677250 - in /httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client: AbstractHttpClient.java DefaultHttpClient.java
Date Wed, 16 Jul 2008 11:45:49 GMT
Author: olegk
Date: Wed Jul 16 04:45:47 2008
New Revision: 677250

URL: http://svn.apache.org/viewvc?rev=677250&view=rev
Log:
Moved the default context initialization code to the DefaultHttpClient#createHttpContext method;
replaced synchronized HttpContext impl with a non synchronized one: there is a new instance
of HttpContext created for each request, there is no point to synchronize access to it

Modified:
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=677250&r1=677249&r2=677250&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
Wed Jul 16 04:45:47 2008
@@ -57,7 +57,6 @@
 import org.apache.http.client.RedirectHandler;
 import org.apache.http.client.UserTokenHandler;
 import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.client.protocol.ClientContext;
 import org.apache.http.conn.ClientConnectionManager;
 import org.apache.http.conn.ConnectionKeepAliveStrategy;
 import org.apache.http.conn.routing.HttpRoutePlanner;
@@ -531,19 +530,6 @@
         synchronized (this) {
 
             HttpContext defaultContext = createHttpContext();
-            defaultContext.setAttribute(
-                    ClientContext.AUTHSCHEME_REGISTRY, 
-                    getAuthSchemes());
-            defaultContext.setAttribute(
-                    ClientContext.COOKIESPEC_REGISTRY, 
-                    getCookieSpecs());
-            defaultContext.setAttribute(
-                    ClientContext.COOKIE_STORE, 
-                    getCookieStore());
-            defaultContext.setAttribute(
-                    ClientContext.CREDS_PROVIDER, 
-                    getCredentialsProvider());
-            
             if (context == null) {
                 execContext = defaultContext;
             } else {

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java?rev=677250&r1=677249&r2=677250&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
Wed Jul 16 04:45:47 2008
@@ -43,6 +43,7 @@
 import org.apache.http.client.params.AuthPolicy;
 import org.apache.http.client.params.ClientPNames;
 import org.apache.http.client.params.CookiePolicy;
+import org.apache.http.client.protocol.ClientContext;
 import org.apache.http.client.protocol.RequestAddCookies;
 import org.apache.http.client.protocol.RequestDefaultHeaders;
 import org.apache.http.client.protocol.RequestProxyAuthentication;
@@ -70,6 +71,7 @@
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.BasicHttpProcessor;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
@@ -79,7 +81,6 @@
 import org.apache.http.protocol.RequestExpectContinue;
 import org.apache.http.protocol.RequestTargetHost;
 import org.apache.http.protocol.RequestUserAgent;
-import org.apache.http.protocol.SyncBasicHttpContext;
 import org.apache.http.util.VersionInfo;
 
 
@@ -196,7 +197,20 @@
 
     @Override
     protected HttpContext createHttpContext() {
-        return new SyncBasicHttpContext(null);
+        HttpContext context = new BasicHttpContext();
+        context.setAttribute(
+                ClientContext.AUTHSCHEME_REGISTRY, 
+                getAuthSchemes());
+        context.setAttribute(
+                ClientContext.COOKIESPEC_REGISTRY, 
+                getCookieSpecs());
+        context.setAttribute(
+                ClientContext.COOKIE_STORE, 
+                getCookieStore());
+        context.setAttribute(
+                ClientContext.CREDS_PROVIDER, 
+                getCredentialsProvider());
+        return context;
     }
 
     



Mime
View raw message