On Mon, 2014-12-22 at 15:11 +0100, Stéphane Nicoll wrote: > Hi, > > I am working on the Spring framework and we are trying to properly update > some of our helper classes to HC 4.3[1]. 4.3 has moved some configuration > to a RequestConfig object and does not allow the HttpClient to be > customized once it has been built (as far as I can see!). > > Our factory has the ability to set the read or connection timeout in a > convenient way and we make sure to update the underlying infrastructure. > With 4.3 we have moved that code to the creation of a custom RequestConfig > instance per request based on the state of the factory. > > Instead of overriding everything as we do know, I'd like to be able to > *merge* our customizations with the default settings of the current http > client. But there is no accessor to the default RequestConfig object. Is > that intended? >
Hi Stéphane Yes, it was intended. The process of request execution should be customized through HttpContext instance associated with individual HTTP exchanges. HttpClient instances can be configured to provide some global defaults in case HttpContext has not been explicitly specified. One could use a custom protocol interceptor to get hold of the default RequestConfig instance and replace it with a new one, but such interceptor would need to be added to the protocol execution chain at the client's construction time. > The only solution I could see would be to request the user to pass the > HttpClient to use *and/or* the default RequestConfig to use. That feels odd > since the latter can be set in the former (but I can't access it once the > client has been built). > > Thoughts? > I am afraid there is no elegant way out of this situation. One option might be to let the users provide an instance of HttpClientBuilder instead of HttpClient, which would enable Spring introduce additional interceptors to the protocol processing chain. Oleg > S. > > [1] https://jira.spring.io/browse/SPR-12166 - > https://jira.spring.io/browse/SPR-12540 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
