Skip to content

Commit

Permalink
Fix API change
Browse files Browse the repository at this point in the history
jetty/jetty.project#7078 caused a regression in the way WebSocketUpgradeFilters could be applied.  This change was intentional, using API as instructed by Jetty team. :)
  • Loading branch information
tresf committed Mar 23, 2022
1 parent cde8756 commit cfb5061
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/qz/ws/PrintSocketServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.MultiException;
import org.eclipse.jetty.websocket.server.NativeWebSocketServletContainerInitializer;
import org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter;
import qz.common.Constants;
import qz.common.TrayManager;
Expand Down Expand Up @@ -161,9 +162,11 @@ public static void runServer() {
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);

// Handle WebSocket connections
WebSocketUpgradeFilter filter = WebSocketUpgradeFilter.configure(context);
filter.addMapping(new ServletPathSpec("/"), (req, resp) -> new PrintSocketClient(server));
filter.getFactory().getPolicy().setMaxTextMessageSize(MAX_MESSAGE_SIZE);
WebSocketUpgradeFilter.configure(context);
NativeWebSocketServletContainerInitializer.configure(context, (ctx, container) -> {
container.addMapping(new ServletPathSpec("/"), (req, resp) -> new PrintSocketClient(server));
container.getPolicy().setMaxTextMessageSize(MAX_MESSAGE_SIZE);
});

// Handle HTTP landing page
ServletHolder httpServlet = new ServletHolder(new HttpAboutServlet(certificateManager));
Expand Down

0 comments on commit cfb5061

Please sign in to comment.