HTTPCLIENT-689: parameter stack building moved to AbstractHttpClient

git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@586567 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Roland Weber 2007-10-19 18:18:21 +00:00
parent bf541ba1fd
commit 13124872f7
3 changed files with 27 additions and 8 deletions

View File

@ -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>

View File

@ -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.
* <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);
}
/**
* Determines the route for a request.
* Called by {@link #execute(HttpUriRequest,HttpContext)

View File

@ -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 =