-
Notifications
You must be signed in to change notification settings - Fork 923
Replace httpclient.execute call with httpclient.executeOpen as mentioned in deprecation notes of httpclient.execute #6298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace httpclient.execute call with httpclient.executeOpen as mentioned in deprecation notes of httpclient.execute #6298
Conversation
…passing it via defaultconnectionconfigs
…ned in deprecation notes of httpclient.execute
651f569
to
d944a98
Compare
d944a98
to
e734ebc
Compare
2af2770
to
daf8d7e
Compare
|
...ents/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/Apache5HttpClient.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also add an test to check the thrown exception since we extracted the logic outside but that's optional
I investigated adding test cases to verify the exception handling in determineTarget(), but it's not feasible to trigger this code path in practice. The SDK performs validation at the request builder level and in higher-level components, ensuring that only valid targets reach the low-level HTTP client. Any request that would cause RoutingSupport.determineHost() to throw an HttpException is already rejected by the SDK's validation layer before reaching the Apache client. |
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |
Motivation and Context
The Apache HttpClient 5
execute()
method is deprecated with a warning to useexecuteOpen()
instead when we need to keep the response object open after request execution. OurApache5HttpClient
implementation requires keeping the response open because we wrap it in anAbortableInputStream
for proper resource management.This change eliminates the deprecation warning and ensures we're using the recommended API for our use case.
Modifications
Apache5HttpClient.java:
httpClient.execute()
withhttpClient.executeOpen()
determineTarget()
method that usesRoutingSupport.determineHost()
to extract the target host from the requestHttpException
toClientProtocolException
RoutingSupport
andClientProtocolException
Apache5SdkHttpClient.java:
executeOpen()
method to the delegate implementation to support the new APIMetricReportingTest.java:
executeOpen()
instead of deprecatedexecute()
Testing
MetricReportingTest
to mock the newexecuteOpen()
methodAbortableInputStream
wrapping continue to work correctlyLicense