You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ro...@apache.org on 2007/10/19 20:18:22 UTC

svn commit: r586567 - in /jakarta/httpcomponents/httpclient/trunk: RELEASE_NOTES.txt module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java

Author: rolandw
Date: Fri Oct 19 11:18:21 2007
New Revision: 586567

URL: http://svn.apache.org/viewvc?rev=586567&view=rev
Log:
HTTPCLIENT-689: parameter stack building moved to AbstractHttpClient

Modified:
    jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java

Modified: jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=586567&r1=586566&r2=586567&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Fri Oct 19 11:18:21 2007
@@ -1,5 +1,8 @@
 Changes since release 4.0 Alpha 1
 
+* [HTTPCLIENT-689] stackable parameters in AbstractHttpClient
+  Contributed by Roland Weber <rolandw at apache.org>
+
 * [HTTPCLIENT-477] Use distinct instances of the authentication handler 
   interface for authentication with target and proxy hosts
   Contributed by Oleg Kalnichevski <olegk at apache.org>

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=586567&r1=586566&r2=586567&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java Fri Oct 19 11:18:21 2007
@@ -518,7 +518,7 @@
                     getRedirectHandler(),
                     getTargetAuthenticationHandler(),
                     getProxyAuthenticationHandler(),
-                    getParams());
+                    determineParams(roureq.getRequest()));
         }
 
         HttpResponse response = director.execute(roureq, context);
@@ -531,6 +531,27 @@
         return response;
 
     } // execute
+
+
+    /**
+     * Obtains parameters for executing a request.
+     * The default implementation in this class creates a new
+     * {@link ClientParamsStack} from the request parameters
+     * and the client parameters.
+     * <br/>
+     * This method is called by the default implementation of
+     * {@link #execute(RoutedRequest,HttpContext)}
+     * to obtain the parameters for the
+     * {@link DefaultClientRequestDirector}.
+     *
+     * @param req    the request that will be executed
+     *
+     * @return  the parameters to use
+     */
+    protected HttpParams determineParams(HttpRequest req) {
+        return new ClientParamsStack
+            (null, getParams(), req.getParams(), null);
+    }
 
 
     /**

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java?rev=586567&r1=586566&r2=586567&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java Fri Oct 19 11:18:21 2007
@@ -263,11 +263,6 @@
 
         HttpRequest orig = roureq.getRequest();
 
-        //@@@ build the parameter stack in the client?
-        //@@@ that's the place to keep application and override params
-        final HttpParams stackedparams = new ClientParamsStack
-            (null, this.params, orig.getParams(), null);
-
         long timeout = HttpClientParams.getConnectionManagerTimeout(params);
         
         int execCount = 0;
@@ -310,7 +305,7 @@
 
                 // Wrap the original request
                 RequestWrapper request = wrapRequest(roureq.getRequest());
-                request.setParams(stackedparams);
+                request.setParams(this.params);
                 
                 // Re-write request URI if needed
                 rewriteRequestURI(request, route);
@@ -370,7 +365,7 @@
                     throw ex;
                 }
 
-                response.setParams(stackedparams);
+                response.setParams(this.params);
                 requestExec.postProcess(response, httpProcessor, context);
                 
                 RoutedRequest followup =