if(endpoint != null) { container.addEndpoint(endpoint); addManagementWebsocket(deploymentUnit, endpoint.getEndpointClass(), endpoint.getPath());
@Override public String getPath() { return perEndpointConfig.getPath(); }
@Override public String getPath() { return delegate.getPath(); }
@Override public String getPath() { return config.getPath(); }
@Override public String getPath() { return perEndpointConfig.getPath(); }
@Override public String getPath() { return config.getPath(); }
@Override public String getPath() { return delegate.getPath(); }
@Override public String getPath() { return perEndpointConfig.getPath(); }
@Override public String getPath() { return perEndpointConfig.getPath(); }
@Override public String getPath() { return perEndpointConfig.getPath(); }
@Override public String getPath() { return perEndpointConfig.getPath(); }
@Override public String getPath() { return config.getPath(); }
//called when the client first negotiates the opening of the websocket connection public void onOpen(Session session, ServerEndpointConfig config){ String path = config.getPath(); }
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 String toString() { StringBuilder builder = new StringBuilder(); builder.append("SimpleServerEndpointMetadata ["); builder.append("config=").append(config.getClass().getName()); builder.append(",path=").append(config.getPath()); builder.append(",endpoint=").append(config.getEndpointClass()); builder.append(",decoders=").append(config.getDecoders()); builder.append(",encoders=").append(config.getEncoders()); builder.append("]"); return builder.toString(); } }
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 add(final ServerEndpointConfig serverConfig, final ObjectNode config) throws ServletException { // TODO: config hierarchy... if (server == null) { if (config != null) { initServer((ObjectNode) config.get("jetty")); } else { initServer(JOM.createObjectNode()); } } LOG.info("Registering websocket server endpoint:" + serverConfig.getPath()); try { wscontainer.addEndpoint(serverConfig); } catch (final DeploymentException e) { LOG.log(Level.WARNING, "Couldn't initialize websocket server endpoint.", e); } } }
@Override public void onOpen(Session session, EndpointConfig endpointConfig) { // set timeout long oldMaxIdleTimeout = session.getMaxIdleTimeout(); long newMaxIdleTimeout = 0; session.setMaxIdleTimeout(newMaxIdleTimeout); if (log.isDebugEnabled()) log.debug("Changed max idle timeout of session " + session.getId() + " from " + oldMaxIdleTimeout + " to " + newMaxIdleTimeout); // read properties ServerEndpointConfig serverEndpointConfig = (ServerEndpointConfig) endpointConfig; WebSocketTransport webSocketTransport = (WebSocketTransport) serverEndpointConfig.getUserProperties().get("webSocketTransport"); // init message handler WebSocketServerMessageHandler webSocketMessageHandler = new WebSocketServerMessageHandler(session); // init session log.info("WebSocket session " + session.getId() + " opened (" + serverEndpointConfig.getPath() + ")."); session.addMessageHandler(webSocketMessageHandler); session.getUserProperties().putAll(serverEndpointConfig.getUserProperties()); // register session webSocketTransport.registerSession(session, null); }
@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); } }
public BasicServerEndpointConfig(WebSocketContainerScope containerScope, ServerEndpointConfig copy) { // immutable concepts this.endpointClass = copy.getEndpointClass(); this.path = copy.getPath(); this.decoders = copy.getDecoders(); this.encoders = copy.getEncoders(); this.subprotocols = copy.getSubprotocols(); this.extensions = copy.getExtensions(); ServerEndpointConfig.Configurator cfgr; if (copy.getConfigurator() != null) { cfgr = copy.getConfigurator(); } else { cfgr = new ContainerDefaultConfigurator(); } // Make sure all Configurators obtained are decorated this.configurator = containerScope.getObjectFactory().decorate(cfgr); // mutable concepts this.userProperties = new HashMap<>(copy.getUserProperties()); }