Package javax.websocket.server

Examples of javax.websocket.server.ServerContainer.addEndpoint()


            super.contextInitialized(sce);
            ServerContainer sc =
                    (ServerContainer) sce.getServletContext().getAttribute(
                            Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);
            try {
                sc.addEndpoint(ServerEndpointConfig.Builder.create(
                        ConstantTxEndpoint.class, PATH).build());
                if (TestWsWebSocketContainer.timoutOnContainer) {
                    sc.setAsyncSendTimeout(TIMEOUT_MS);
                }
            } catch (DeploymentException e) {
View Full Code Here


            ServerContainer sc =
                    (ServerContainer) sce.getServletContext().getAttribute(
                            org.apache.tomcat.websocket.server.Constants.
                            SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);
            try {
                sc.addEndpoint(new ServerEndpointConfig() {
                    @Override
                    public Map<String, Object> getUserProperties() {
                        return Collections.emptyMap();
                    }
                    @Override
View Full Code Here

                    .subprotocols(protocols)
                    .configurator(new Configurator(context))
                    .build();
            try
            {
                container.addEndpoint(config);
            }
            catch (DeploymentException x)
            {
                throw new RuntimeException(x);
            }
View Full Code Here

        server.setHandler(context);

        ServerContainer wscontainer = WebSocketServerContainerInitializer.configureContext(context);

        try {
            wscontainer.addEndpoint(new RPDEndpointConfig());
            server.start();
            server.join();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

    public void contextInitialized(ServletContextEvent sce) {
        final ServerContainer serverContainer = (ServerContainer) sce.getServletContext().getAttribute("javax.websocket.server.ServerContainer");

        try {
            // this is the important call
            serverContainer.addEndpoint(ServerEndpointConfig.Builder.create(MyServletContextListenerProgrammatic.class,
                    "/programmatic").build());
        } catch (DeploymentException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

    public void contextInitialized(ServletContextEvent servletContextEvent) {
        final ServerContainer serverContainer = (ServerContainer) servletContextEvent.getServletContext().getAttribute("javax.websocket.server.ServerContainer");

        try {
            // this is the important call
            serverContainer.addEndpoint(MyServletContextListenerAnnotated.class);
        } catch (DeploymentException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

    public void init(ServletConfig c) throws ServletException {
        String websocketPath = "/foo";
        ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgramaticEndpoint.class, websocketPath).build();
        ServerContainer serverContainer = (ServerContainer) c.getServletContext().getAttribute("javax.websocket.server.ServerContainer");
        try {
            serverContainer.addEndpoint(config);
        } catch (DeploymentException ex) {
            throw new ServletException("Error deploying websocket endpoint:", ex);
        }
    }
View Full Code Here

            super.contextInitialized(sce);
            ServerContainer sc =
                    (ServerContainer) sce.getServletContext().getAttribute(
                            Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);
            try {
                sc.addEndpoint(BlockingPojo.class);
            } catch (DeploymentException e) {
                throw new IllegalStateException(e);
            }
        }
    }
View Full Code Here

            super.contextInitialized(sce);
            ServerContainer sc =
                    (ServerContainer) sce.getServletContext().getAttribute(
                            Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);
            try {
                sc.addEndpoint(ServerEndpointConfig.Builder.create(
                        ConstantTxEndpoint.class, PATH).build());
                if (TestWsWebSocketContainer.timoutOnContainer) {
                    sc.setAsyncSendTimeout(TIMEOUT_MS);
                }
            } catch (DeploymentException e) {
View Full Code Here

                    KafkaProducerFactory.create(producerProps, Class.forName(inputTransformClassName));

            KafkaWebsocketEndpoint.Configurator.CONSUMER_FACTORY = consumerFactory;
            KafkaWebsocketEndpoint.Configurator.PRODUCER = producerFactory.getProducer();

            wsContainer.addEndpoint(KafkaWebsocketEndpoint.class);

            server.start();
            server.join();
        } catch (Exception e) {
            LOG.error("Failed to start the server: {}", e.getMessage());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.