You can use the
org.eclipse.jetty.websocket.core.server.WebSocketUpgradeHandler.

That is a HandlerWrapper with mappings.
You don't extend from that class, you configure it, and set it up as a
wrapper in your Server handler tree.

Note that this is a websocket-core concept, so it's not jakarta.websocket
or jetty.websocket (both of which require Servlet stuff)

For an example, see ...

https://github.com/eclipse/jetty.project/blob/jetty-11.0.x/jetty-websocket/websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java

Joakim Erdfelt / joa...@webtide.com


On Mon, Aug 15, 2022 at 10:34 AM Matthias Pfau via jetty-users <
jetty-users@eclipse.org> wrote:

> Hi there,
> we are currently upgrading to jetty 11. With jetty 9, we were only using
> handlers and no servlets at all. That is why we used the WebsocketHandler
> to do a programmatic upgrade.
>
> There is an example on how to do a programmatic upgrade in the docs
> (ProgrammaticWebSocketUpgradeServlet). However, it seems like you need to
> pass a ServletContext to JettyWebSocketServerContainer#getContainer. We
> don't have one, so we can't obtain a reference to
> the JettyWebSocketServerContainer (servletContext on baseRequest passed to
> handlers is null).
> Do we need to use Servlets/ServletContext now? Or is there a way to stick
> to handlers?
>
> Best,
> Matthias
>
> Reference to doc:
> https://www.eclipse.org/jetty/documentation/jetty-11/programming-guide/index.html#pg-server-websocket-jetty
> _______________________________________________
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to