public static ServerContainer configureContext(final MutableServletContextHandler context, final MetricRegistry metrics) throws ServletException { WebSocketUpgradeFilter filter = WebSocketUpgradeFilter.configureContext(context); NativeWebSocketConfiguration wsConfig = filter.getConfiguration(); ServerContainer wsContainer = new ServerContainer(wsConfig, context.getServer().getThreadPool()); EventDriverFactory edf = wsConfig.getFactory().getEventDriverFactory(); edf.clearImplementations(); edf.addImplementation(new InstJsrServerEndpointImpl(metrics)); edf.addImplementation(new InstJsrServerExtendsEndpointImpl(metrics)); context.addBean(wsContainer); context.setAttribute(javax.websocket.server.ServerContainer.class.getName(), wsContainer); context.setAttribute(WebSocketUpgradeFilter.class.getName(), filter); return wsContainer; } }
public static ServerContainer configureContext(final MutableServletContextHandler context, final MetricRegistry metrics) throws ServletException { WebSocketUpgradeFilter filter = WebSocketUpgradeFilter.configureContext(context); NativeWebSocketConfiguration wsConfig = filter.getConfiguration(); ServerContainer wsContainer = new ServerContainer(wsConfig, context.getServer().getThreadPool()); EventDriverFactory edf = wsConfig.getFactory().getEventDriverFactory(); edf.clearImplementations(); edf.addImplementation(new InstJsrServerEndpointImpl(metrics)); edf.addImplementation(new InstJsrServerExtendsEndpointImpl(metrics)); context.addBean(wsContainer); context.setAttribute(javax.websocket.server.ServerContainer.class.getName(), wsContainer); context.setAttribute(WebSocketUpgradeFilter.class.getName(), filter); return wsContainer; } }