diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 50a6735e2..062bf8c9a 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,5 +1,8 @@ Changes since release 4.0 Alpha 1 +* [HTTPCLIENT-689] stackable parameters in AbstractHttpClient + Contributed by Roland Weber + * [HTTPCLIENT-477] Use distinct instances of the authentication handler interface for authentication with target and proxy hosts Contributed by Oleg Kalnichevski diff --git a/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java b/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java index 83ee3b587..df0ffcd76 100644 --- a/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java +++ b/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java @@ -518,7 +518,7 @@ public abstract class AbstractHttpClient getRedirectHandler(), getTargetAuthenticationHandler(), getProxyAuthenticationHandler(), - getParams()); + determineParams(roureq.getRequest())); } HttpResponse response = director.execute(roureq, context); @@ -533,6 +533,27 @@ public abstract class AbstractHttpClient } // 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. + *
+ * 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); + } + + /** * Determines the route for a request. * Called by {@link #execute(HttpUriRequest,HttpContext) diff --git a/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java b/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java index 958c5622c..e19252af9 100644 --- a/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java +++ b/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java @@ -263,11 +263,6 @@ public class DefaultClientRequestDirector 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 @@ public class DefaultClientRequestDirector // 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 @@ public class DefaultClientRequestDirector throw ex; } - response.setParams(stackedparams); + response.setParams(this.params); requestExec.postProcess(response, httpProcessor, context); RoutedRequest followup =