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
FELIX-6692 jetty 12.x websockets new approach (based on #309) #310
FELIX-6692 jetty 12.x websockets new approach (based on #309) #310
Conversation
This reverts commit 6d95c93.
- Apply 11.x approach to jetty12 bundle - Add two new classifiers 'with-jetty-ee10-websockets' and 'with-jakarta-ee10-websockets' to have a fat jar containing the appropriate websocket classes
Do note that the workaround in FelixJettyWebSocketServlet are still required; the initialization code in the Jetty12 bundle doesn't seem to work
I tried to adapt the example i had and remove the workarounds that we had before, but these are still required to get it to work. The initialization code in the In the example from @enapps-enorman:
|
As we use the same Apache Felix code base for both, maybe this is something that changed in Jetty 12? Although that sounds a little bit wired |
I do see jetty/jetty.project#9925, but that has already been fixed. Maybe i can debug the jetty code a bit to see where it fails. |
I found out that https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java#L510 is the culprit, and setting I can get the example to work now 👍 One downside is that the current servlet context is irrelevant to the websocket being registered.
Registers the websocket on Not sure if this is a big problem though.
Also, i will try to incorporate the same units tests. |
Both examples work, i will push the changes and move on to the unit tests. |
…n Jetty 12. See https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java#L510 and jetty/jetty.project#9774 * Add example based on registering the websocket to the main servlet context instead of the per-bundle one -
…ew-approach # Conflicts: # http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
@enapps-enorman @cziegeler I took the unit tests from #309 and adjusted these to run on Jetty12. I think we have a solid solution in place now. Let me know what you think. |
http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
Outdated
Show resolved
Hide resolved
…let context once available This removes the need to set setCrossContextDispatchSupported, as the WS container is available on the proper servlet context itself
Removed other WebSocket example, as this is no longer needed with the new approach. Updated documentation.
…o register a WebSocket endpoint that abides to the servlet context it's registered to.
I kept both examples in the whiteboard bundle, as both have value:
For my own project, the first approach wouldn't work, as we register multiple instances of the same servlet class which would then overwrite the WS mapping on the WebSocket container. Using the |
Rename org.apache.felix.jetty.websocket.enable to org.apache.felix.jetty.ee9.websocket.enable Incorporate the changes for using maybeStoreWebSocketContainerAttributes
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.
This looks good to me.
http/jetty12/src/test/java/org/apache/felix/http/jetty/it/JettySpecificWebsocketIT.java
Outdated
Show resolved
Hide resolved
@cziegeler can you check out this PR and #309? Both are now aligned to use the same approach. If you're ok with having the two additional classifiers for Jetty12, could these also be published to the maven repo? |
* FELIX-6692 Add Jetty WebSocket support for jetty 11.x * FELIX-6692 rename jakarta websocket enable config for future expansion * FELIX-6692 add paxexam integration tests to verify the functionality * FELIX-6692 cleanup * FELIX-6692 merge changes from PR #310 Rename org.apache.felix.jetty.websocket.enable to org.apache.felix.jetty.ee9.websocket.enable Incorporate the changes for using maybeStoreWebSocketContainerAttributes * FELIX-6692 renamed for consistency
@paulrutter The additional classifiers look good to me, they should be pushed automatically to maven central when we do the release |
Based on the Jetty 11.x websocket work in #309, a new PR that incorporates a similar style for Jetty 12.
It adds two new classifiers:
with-jetty-ee10-websockets
: jar with the additional Jetty EE10 websocket classeswith-jakarta-ee10-websockets
: jar with the additional Jakarta EE10 websocket classesThe main jar and the light jar remain the same.
Two new configuration options:
org.apache.felix.jakarta.ee10.websocket.enable
org.apache.felix.jetty.ee10.websocket.enable
Needs additional tests/examples though, not a finished PR yet.