org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter Java Examples

The following examples show how to use org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstWebSocketServerContainerInitializer.java    From dropwizard-websockets with MIT License 5 votes vote down vote up
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;
}