container.addEndpoint( ServerEndpointConfig.Builder .create(
configureContext.addEndpoint(Jsr356Impl.class); } catch (ServletException e) { e.printStackTrace();
/** * Add a Web socket endpoint. */ public void addEndpoint(ServerEndpointConfig endpointConfig) throws DeploymentException { if (serverContainer == null) { webSocketEndpoints.add(endpointConfig); } else { serverContainer.addEndpoint(endpointConfig); } }
@Override protected void doStart() throws Exception { // Proceed with Normal Startup super.doStart(); // Process Deferred Endpoints if (deferredEndpointClasses != null) { for (Class<?> endpointClass : deferredEndpointClasses) { addEndpoint(endpointClass); } deferredEndpointClasses.clear(); } if (deferredEndpointConfigs != null) { for (ServerEndpointConfig config : deferredEndpointConfigs) { addEndpoint(config); } deferredEndpointConfigs.clear(); } }
private void addEndpoint(ServerContainer wsContainer, ServerEndpointConfig conf, StringBuilder sb) throws DeploymentException { wsContainer.addEndpoint(conf); sb.append(String.format(" WS %s (%s)", conf.getPath(), conf.getEndpointClass().getName())).append(System.lineSeparator()); } });
private void addEndpoint(ServerContainer wsContainer, ServerEndpointConfig conf, StringBuilder sb) throws DeploymentException { wsContainer.addEndpoint(conf); sb.append(String.format(" WS %s (%s)", conf.getPath(), conf.getEndpointClass().getName())).append(System.lineSeparator()); } });
@Override public void addEndpoint(Class<?> endpointClass) throws DeploymentException { if (isStarted() || isStarting()) { ServerEndpointMetadata metadata = getServerEndpointMetadata(endpointClass,null); addEndpoint(metadata); } else { if (deferredEndpointClasses == null) { deferredEndpointClasses = new ArrayList<Class<?>>(); } deferredEndpointClasses.add(endpointClass); } }
container.addEndpoint(JsrBrowserSocket.class);
protected void initServer() { server = new Server(httpPort); attachServerLifecycleListeners(); server.setHandler(wrapHandlers()); if (isWebSocketInClassPath()) { setupForWebSocket(); try { for (ServerEndpointConfig endpoint : webSocketEndpoints) { log().debug("add WebSocket endpoint " + endpoint); serverContainer.addEndpoint(endpoint); } } catch (DeploymentException e) { throw new IllegalStateException("Failed to add webSocket endpoint", e); } } }
@Override public void addEndpoint(ServerEndpointConfig config) throws DeploymentException { if (isStarted() || isStarting()) { if (LOG.isDebugEnabled()) { LOG.debug("addEndpoint({}) path={} endpoint={}",config,config.getPath(),config.getEndpointClass()); } ServerEndpointMetadata metadata = getServerEndpointMetadata(config.getEndpointClass(),config); addEndpoint(metadata); } else { if (deferredEndpointConfigs == null) { deferredEndpointConfigs = new ArrayList<ServerEndpointConfig>(); } deferredEndpointConfigs.add(config); } }
jettyContainer.addEndpoint(config); jettyContainer.addEndpoint(annotatedClass);
serverContainer.addEndpoint(serverEndpointConfig);
private Server setup() throws IOException, DeploymentException, ServletException { synchronized (this) { checkState(server == null, "Server already started."); } MatlabInstancePool pool = new MatlabInstancePool(MatlabInstancePoolConfiguration .builder() .withMaximalNumInstances(getOptions().getThreads()) .withInstanceConfig(MatlabInstanceConfiguration .builder() .withBaseDir(getOptions().getPath()) .hidden(getOptions().isHidden()) .build()) .build()); Server jetty = new Server(getOptions().getPort()); ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS); handler.setContextPath("/"); jetty.setHandler(handler); handler.addLifeCycleListener(new MatlabInstancePoolDestroyer(pool)); ServerContainer sc = WebSocketServerContainerInitializer.configureContext(handler); sc.addEndpoint(ServerEndpointConfig.Builder.create(MatlabServerEndpoint.class, "/") .configurator(new MatlabServerEndpointConfigurator(pool)).build()); return jetty; }