You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With this change, the current implementationof HttpComponentClientHttpRequestFactory#createRequest does not work (anymore), because it uses the old context.getAttribute() and context.setAttribute() Methods which do not have any effect anymore (at least on HttpClientContext instances)
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException {
...
// Request configuration not set in the context
if (context.getAttribute(HttpClientContext.REQUEST_CONFIG) == null) {
....
if (config != null) {
context.setAttribute(HttpClientContext.REQUEST_CONFIG, config);
}
}
return new HttpComponentsClientHttpRequest(client, httpRequest, context);
}
As an side effect, the new support for readtimeout isnt working for RestTemplates und RestClients
A solution might be to use the getter/setter Methods for RequestConfig:
HttpClientContext httpClientContext = HttpClientContext.cast(context);
// Request configuration not set in the context
if (httpClientContext.getRequestConfig() == null) {
// Use request configuration given by the user, when available
RequestConfig config = null;
if (httpRequest instanceof Configurable configurable) {
config = configurable.getConfig();
}
if (config == null) {
config = createRequestConfig(client);
}
if (config != null) {
httpClientContext.setRequestConfig(config);
}
}
return new HttpComponentsClientHttpRequest(client, httpRequest, context);
The text was updated successfully, but these errors were encountered:
jhoeller
changed the title
Spring Framework 6.2.0 RC3 HttpComponentsClientHttpRequestFactory setReadTimeout not working with httpclient 5.4
HttpComponentsClientHttpRequestFactory setReadTimeout not working with httpclient 5.4
Oct 29, 2024
httpcomponents httpclient5 changed the internal implementation of HttpClientContext with version 5.4
apache/httpcomponents-client@762b18f
using instance variables for standard attributes instead of map-like attributes.
With this change, the current implementationof HttpComponentClientHttpRequestFactory#createRequest does not work (anymore), because it uses the old
context.getAttribute()
andcontext.setAttribute()
Methods which do not have any effect anymore (at least onHttpClientContext
instances)As an side effect, the new support for readtimeout isnt working for RestTemplates und RestClients
A solution might be to use the getter/setter Methods for RequestConfig:
The text was updated successfully, but these errors were encountered: