Configure HttpClient connection timeout via ConnectionConfig#3864
Closed
gdgenchev wants to merge 1 commit intocloudfoundry:developfrom
Closed
Configure HttpClient connection timeout via ConnectionConfig#3864gdgenchev wants to merge 1 commit intocloudfoundry:developfrom
gdgenchev wants to merge 1 commit intocloudfoundry:developfrom
Conversation
Replace deprecated HttpComponentsClientHttpRequestFactory.setConnectTimeout() with ConnectionConfig.setConnectTimeout() on PoolingHttpClientConnectionManager. The connection timeout is now configured at the connection manager level using the recommended ConnectionConfig.Builder API.
7e677a3 to
f489bd9
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Updates UAA’s Apache HttpClient/Spring RestTemplate setup to configure the TCP connection timeout using Apache HttpClient’s ConnectionConfig on the PoolingHttpClientConnectionManager, aligning with Spring’s removal of HttpComponentsClientHttpRequestFactory.setConnectTimeout() in Spring 7.
Changes:
- Remove usage of
HttpComponentsClientHttpRequestFactory.setConnectTimeout(...). - Add connect-timeout configuration via
ConnectionConfig.setConnectTimeout(Timeout)on the pooling connection manager. - Update the unit test to use the new
getClientBuilder(..., connectTimeoutInMs)signature.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| server/src/main/java/org/cloudfoundry/identity/uaa/util/UaaHttpRequestUtils.java | Moves connect-timeout configuration from Spring’s request factory to Apache HttpClient connection manager ConnectionConfig. |
| server/src/test/java/org/cloudfoundry/identity/uaa/util/UaaHttpRequestUtilsTest.java | Updates test helper to call the updated getClientBuilder API with an explicit connect timeout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+115
to
+119
| ConnectionConfig connectionConfig = ConnectionConfig.custom() | ||
| .setConnectTimeout(Timeout.ofMilliseconds(connectTimeoutInMs)) | ||
| .build(); | ||
| cm.setDefaultConnectionConfig(connectionConfig); | ||
|
|
Member
|
@gdgenchev I have done changes from my local review to extra commit of #3892 |
Contributor
|
#3892 appears to try to address the same thing. which one would you like approved? |
Contributor
Author
|
Let's continue in #3892 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HttpComponentsClientHttpRequestFactory.setConnectTimeout()was deprecated in Spring 6 and later removed in Spring 7. It is replaced withConnectionConfig.setConnectTimeout()onPoolingHttpClientConnectionManager. The connection timeout is now configured at the connection manager level using the recommended ConnectionConfig.Builder API.https://github.com/spring-projects/spring-framework/blob/9f431e2eac1b6d8d5ca385d0cc367bac94dd37e7/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java#L128-L133