Java Code Examples for org.eclipse.jetty.websocket.servlet.WebSocketServletFactory#register()
The following examples show how to use
org.eclipse.jetty.websocket.servlet.WebSocketServletFactory#register() .
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: MinicapJettyServer.java From android-uiconductor with Apache License 2.0 | 6 votes |
public void runServer() { if (server.isStarted()) { return; } System.out.println("server port: " + port); WebSocketHandler wsHandler = new WebSocketHandler() { @Override public void configure(WebSocketServletFactory factory) { factory.register(MinicapWebSocketHandler.class); } }; server.setHandler(wsHandler); try { server.start(); server.join(); } catch (Exception e) { logger.warning(e.getMessage()); } }
Example 2
Source File: WebSocketTest.java From htmlunit with Apache License 2.0 | 5 votes |
@Override public void configure(final WebSocketServletFactory factory) { factory.register(ChatWebSocket.class); factory.setCreator(new WebSocketCreator() { @Override public Object createWebSocket(final ServletUpgradeRequest servletUpgradeRequest, final ServletUpgradeResponse servletUpgradeResponse) { return new ChatWebSocket(); } }); }
Example 3
Source File: WebSocketTest.java From htmlunit with Apache License 2.0 | 5 votes |
@Override public void configure(final WebSocketServletFactory factory) { factory.register(CookiesWebSocket.class); factory.setCreator(new WebSocketCreator() { @Override public Object createWebSocket(final ServletUpgradeRequest servletUpgradeRequest, final ServletUpgradeResponse servletUpgradeResponse) { return new CookiesWebSocket(); } }); }
Example 4
Source File: WebSocketTest.java From htmlunit with Apache License 2.0 | 5 votes |
@Override public void configure(final WebSocketServletFactory factory) { factory.register(EventsWebSocket.class); factory.setCreator(new WebSocketCreator() { @Override public EventsWebSocket createWebSocket(final ServletUpgradeRequest servletUpgradeRequest, final ServletUpgradeResponse servletUpgradeResponse) { return new EventsWebSocket(); } }); }
Example 5
Source File: ClientProxy.java From OmniOcular with Apache License 2.0 | 5 votes |
@Override public void startHttpServer() { Thread t = new Thread(new Runnable() { @Override public void run() { Server server = new Server(23333); try { ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); ServletHolder wsHolder = new ServletHolder("echo", new WebSocketServlet() { @Override public void configure(WebSocketServletFactory factory) { factory.register(WebSocketHandler.class); } }); context.addServlet(wsHolder, "/w"); URI uri = OmniOcular.class.getResource("/assets/omniocular/static/").toURI(); context.setBaseResource(Resource.newResource(uri)); context.setWelcomeFiles(new String[]{"index.html"}); ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class); holderPwd.setInitParameter("cacheControl", "max-age=0,public"); holderPwd.setInitParameter("useFileMappedBuffer", "false"); context.addServlet(holderPwd, "/"); server.setHandler(context); server.start(); server.join(); } catch (Exception e) { e.printStackTrace(); } } }); t.start(); }
Example 6
Source File: RoboconfWebSocketServlet.java From roboconf-platform with Apache License 2.0 | 4 votes |
@Override public void configure( WebSocketServletFactory factory ) { factory.register( RoboconfWebSocket.class ); }
Example 7
Source File: EventServlet.java From dawnsci with Eclipse Public License 1.0 | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.register(FileMonitorSocket.class); }
Example 8
Source File: DataServer.java From dawnsci with Eclipse Public License 1.0 | 4 votes |
public void start(boolean block) throws Exception { this.server = new Server(); ServerConnector connector = new ServerConnector(server); connector.setPort(getPort()); connector.setReuseAddress(true); server.addConnector(connector); // We enable sessions on the server so that // we can cache LoaderFactories to a given session. // The loader factory therefore needs a non-global // data soft reference cache. ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); server.setHandler(context); // Make individual servlets // Slicing (large data in binary http) ServletHolder holderSlice = new ServletHolder("slice", SliceServlet.class); context.addServlet(holderSlice, "/slice/*"); // Doing events, like data changing shape. // FIXME Should not be needed WebSocketHandler wsHandler = new WebSocketHandler() { @Override public void configure(WebSocketServletFactory factory) { factory.register(FileMonitorSocket.class); } }; context.setHandler(wsHandler); // FIXME End should not be needed. ServletHolder holderInfo = new ServletHolder("info", InfoServlet.class); context.addServlet(holderInfo, "/info/*"); ServletHolder holderTree = new ServletHolder("tree", TreeServlet.class); context.addServlet(holderTree, "/tree/*"); // Events json objects to notify of problems. ServletHolder holderEvent = new ServletHolder("event", EventServlet.class); context.addServlet(holderEvent, "/event/*"); server.start(); if (block) server.join(); }
Example 9
Source File: DecanterWebSocketServlet.java From karaf-decanter with Apache License 2.0 | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.register(DecanterWebSocketAppender.class); }
Example 10
Source File: ConsoleProxyNoVNCHandler.java From cloudstack with Apache License 2.0 | 4 votes |
@Override public void configure(WebSocketServletFactory webSocketServletFactory) { webSocketServletFactory.register(ConsoleProxyNoVNCHandler.class); }
Example 11
Source File: WebSocketServlet.java From robe with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.register(webSocketClass); }
Example 12
Source File: MetricWebSocketServlet.java From realtime-analytics with GNU General Public License v2.0 | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.register(MetricWebSocket.class); MetricWebSocketCreator webSocketCreator = SpringWebContextHolder.wac.getBean("MetricWebSocketCreator", MetricWebSocketCreator.class); factory.setCreator(webSocketCreator); }
Example 13
Source File: MarauroaWebSocketServlet.java From marauroa with GNU General Public License v2.0 | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.register(WebSocketChannel.class); }
Example 14
Source File: MockEventServlet.java From zeppelin with Apache License 2.0 | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.register(MockEventSocket.class); }
Example 15
Source File: WSServlet.java From Web-API with MIT License | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.getPolicy().setIdleTimeout(10000); factory.register(WSMainSocket.class); }
Example 16
Source File: BrowserVisualizationServlet.java From coordination_oru with GNU General Public License v3.0 | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.register(BrowserVisualizationSocket.class); }
Example 17
Source File: EventServlet.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.register(EventSocket.class); factory.getPolicy().setIdleTimeout(86400000); }
Example 18
Source File: HarServlet.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.getPolicy().setIdleTimeout(86400000); factory.getPolicy().setMaxTextMessageSize(1000 * 1000); factory.register(HarAdapter.class); }
Example 19
Source File: StockTickerServlet.java From graphql-java-subscription-example with MIT License | 4 votes |
@Override public void configure(WebSocketServletFactory factory) { factory.getPolicy().setMaxTextMessageBufferSize(1024 * 1024); factory.getPolicy().setIdleTimeout(30 * 1000); factory.register(StockTickerWebSocket.class); }
Example 20
Source File: WebSocketMetricServlet.java From incubator-nemo with Apache License 2.0 | 4 votes |
@Override public final void configure(final WebSocketServletFactory factory) { // registers WebSocket adapter factory.register(WebSocketMetricAdapter.class); }