Replace Jetty WebSocket adapter with JDK HttpClient-based implementation#1109
Draft
Replace Jetty WebSocket adapter with JDK HttpClient-based implementation#1109
Conversation
- Add JdkWebSocketAdapter using java.net.http.HttpClient and java.net.http.WebSocket - Remove JettyWebSocketAdapter and htmlunit-websocket-client dependency - Update WebClient to default to JdkWebSocketAdapterFactory - Update module-info.java to require java.net.http instead of htmlunit.websocket.client - Update ArchitectureTest to remove Jetty-specific exclusions Agent-Logs-Url: https://github.com/HtmlUnit/htmlunit/sessions/b3db8ccb-ee0a-436b-8c39-85fd25db4747 Co-authored-by: rbri <2544132+rbri@users.noreply.github.com>
…ize binary accumulation - Rename closeIncommingSession -> closeIncomingSession in interface and all callers - Fix 'WebSockt' typos in Javadoc - Update error message to accurately describe supported content types - Use ByteArrayOutputStream for efficient binary message accumulation Agent-Logs-Url: https://github.com/HtmlUnit/htmlunit/sessions/b3db8ccb-ee0a-436b-8c39-85fd25db4747 Co-authored-by: rbri <2544132+rbri@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
rbri
April 12, 2026 17:07
View session
|
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.



Removes the
htmlunit-websocket-client(shaded Jetty 9) dependency and replaces it with ajava.net.http.WebSocketimplementation that ships with the JDK.New:
JdkWebSocketAdapterjava.net.http.HttpClient+java.net.http.WebSocket(standard since JDK 11)WebSocketListenerWebClientcookies via aCookieHandleradapter over the existingWebSocketCookieStoreWebClientOptions.isUseInsecureSSL()via a trust-allSSLContextRemoved
JettyWebSocketAdapterand thehtmlunit-websocket-clientMaven dependencyrequires htmlunit.websocket.clientfrommodule-info.java(replaced withrequires java.net.http)Housekeeping
closeIncommingSession→closeIncomingSessionacross interface and callersWebSockttypos in JavadocArchitectureTestrule now that no production code depends onorg.htmlunit.jettyBackward compatibility
The
WebSocketAdapter,WebSocketAdapterFactory, andWebSocketListenerinterfaces are preserved. Users with custom implementations only need to renamecloseIncommingSession→closeIncomingSession.