paulrutter commented on PR #310:
URL: https://github.com/apache/felix-dev/pull/310#issuecomment-2079364724

   I tried to adapt the example i had before and remove the workarounds that we 
had before, but these are still required to get it to work.
   The initialization code in the `JettyService` does not seem to be enough for 
Jetty12:
   
   In the example from @enapps-enorman:
   
   ```
       private static final class MyWebSocketInitServlet extends HttpServlet {
           private static final long serialVersionUID = -6893620059263229183L;
   
           @Override
           public void init(ServletConfig config) throws ServletException {
               super.init(config);
   
               // The websocket container is attached to the main servlet 
context, not the per-bundle one.
               //  Lookup the ServletContext for the context path where the 
websocket server is attached.
               ServletContext servletContext = config.getServletContext();
               ServletContext rootContext = servletContext.getContext("/");
   
               // Retrieve the JettyWebSocketServerContainer.
               JettyWebSocketServerContainer container = 
JettyWebSocketServerContainer.getContainer(rootContext);
               assertNotNull(container);
               container.addMapping("/mywebsocket1", (upgradeRequest, 
upgradeResponse) -> new MyServerWebSocket());
           }
       }
   ```
   
   `ServletContext rootContext = servletContext.getContext("/");` returns null.
   Any ideas?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@felix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to