-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] Provide default implementations for native HttpClient methods #16781
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
base: trunk
Are you sure you want to change the base?
Conversation
This prevents compilation errors in HttpClient implementations that do not support native Java HTTP operations. Fixes SeleniumHQ#16673
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
diemol
left a comment
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.
Please run the script formatter, at ./scripts/format.sh.
@joerg1985, can you please review as well?
User description
This change prevents compilation errors in
HttpClientimplementations that do not supportnative Java HTTP operations by providing default implementations for the newly added methods.
🔗 Related Issues
Fixes #16673
💥 What does this PR do?
This PR makes the newly introduced native HTTP client methods (
sendNativeandsendAsyncNative) optional by providing default implementations in theHttpClientinterface.The default implementations throw
UnsupportedOperationException, preserving theprevious behavior for clients that do not support Java 11 native HTTP APIs, while
allowing implementations such as
JdkHttpClientto override and provide fullsupport.
🔧 Implementation Notes
defaultin theHttpClientinterface to avoidbreaking existing implementations.
UnsupportedOperationExceptionwere removedfrom internal and test HTTP client implementations.
JdkHttpClient) remainunchanged and continue to provide concrete behavior.
Alternative approaches considered:
added complexity and limited benefit).
💡 Additional Considerations
HttpClientimplementations.HTTP methods.
🔄 Types of changes
PR Type
Bug fix
Description
Adds default implementations for native HTTP methods in
HttpClientinterfaceRemoves redundant method overrides from multiple implementations
Methods now throw
UnsupportedOperationExceptionby defaultAllows implementations to optionally override native HTTP support
Diagram Walkthrough
File Walkthrough
HttpClient.java
Add default implementations for native HTTP methodsjava/src/org/openqa/selenium/remote/http/HttpClient.java
sendAsyncNative()from abstract to default method withUnsupportedOperationExceptionsendNative()from abstract to default method withUnsupportedOperationExceptionRoutableHttpClientFactory.java
Remove redundant native HTTP method overridesjava/src/org/openqa/selenium/grid/web/RoutableHttpClientFactory.java
sendAsyncNative()override that only threw exceptionsendNative()override that only threw exceptionHttpClientinterfaceRemoteWebDriverBuilder.java
Remove redundant native HTTP method overridesjava/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java
sendAsyncNative()override that only threw exceptionsendNative()override that only threw exceptionHttpClientinterfacePassthroughHttpClient.java
Remove redundant native HTTP method overridesjava/test/org/openqa/selenium/grid/testing/PassthroughHttpClient.java
sendAsyncNative()override that only threw exceptionsendNative()override that only threw exceptionHttpClientinterfaceProtocolHandshakeTest.java
Remove redundant native HTTP method overridesjava/test/org/openqa/selenium/remote/ProtocolHandshakeTest.java
sendAsyncNative()override that only threw exceptionsendNative()override that only threw exceptionHttpClientinterfaceNativeHttpClientMethodsTest.java
Minor formatting adjustmentsjava/test/org/openqa/selenium/remote/http/NativeHttpClientMethodsTest.java