java类javax.websocket.server.ServerEndpointConfig的实例源码

ServerMain.java 文件源码 项目:OpenChatAlytics 阅读 40 收藏 0 点赞 0 评论 0
/**
 *
 * @param context the context to add the web socket endpoints to
 * @param rtEventResource The instance of the websocket endpoint to return
 * @throws DeploymentException
 */
private static void setWebSocketEndpoints(ServletContextHandler context,
                                          EventsResource rtEventResource)
        throws DeploymentException, ServletException {

    ServerContainer wsContainer = WebSocketServerContainerInitializer.configureContext(context);

    ServerEndpointConfig serverConfig =
            ServerEndpointConfig.Builder
                                .create(EventsResource.class, EventsResource.RT_EVENT_ENDPOINT)
                                .configurator(new Configurator() {
                                    @Override
                                    public <T> T getEndpointInstance(Class<T> endpointClass)
                                            throws InstantiationException {
                                        return endpointClass.cast(rtEventResource);
                                    }
                                }).build();

    wsContainer.addEndpoint(serverConfig);
}
Configurator.java 文件源码 项目:lucee-websocket 阅读 39 收藏 0 点赞 0 评论 0
public static void configureEndpoint(String endpointPath, Class endpointClass, Class handshakeHandlerClass,
        LuceeApp app) throws ClassNotFoundException, IllegalAccessException, InstantiationException,
        DeploymentException, PageException {

    ServerEndpointConfig serverEndpointConfig = ServerEndpointConfig.Builder.create(endpointClass,
            endpointPath).configurator(
                    (ServerEndpointConfig.Configurator) handshakeHandlerClass.newInstance()).build();

    try {

        ServerContainer serverContainer = (ServerContainer) app.getServletContext().getAttribute(
                "javax.websocket.server.ServerContainer");
        serverContainer.addEndpoint(serverEndpointConfig);
    }
    catch (DeploymentException ex) {

        app.log(Log.LEVEL_DEBUG, "Failed to register endpoint " + endpointPath + ": " + ex.getMessage(),
                app.getName(), "websocket");
    }
    // System.out.println(Configurator.class.getName() + " >>> exit configureEndpoint()");
}
TestCloseBug58624.java 文件源码 项目:tomcat7 阅读 41 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    super.contextInitialized(sce);

    ServerContainer sc = (ServerContainer) sce.getServletContext().getAttribute(
            Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);

    ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(
            Bug58624ServerEndpoint.class, PATH).build();

    try {
        sc.addEndpoint(sec);
    } catch (DeploymentException e) {
        throw new RuntimeException(e);
    }
}
TestWsServerContainer.java 文件源码 项目:tomcat7 阅读 37 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    super.contextInitialized(sce);

    ServerContainer sc =
            (ServerContainer) sce.getServletContext().getAttribute(
                    Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);

    ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(
            TesterEchoServer.Basic.class, "/{param}").build();

    try {
        sc.addEndpoint(sec);
    } catch (DeploymentException e) {
        throw new RuntimeException(e);
    }
}
TestWsServerContainer.java 文件源码 项目:tomcat7 阅读 46 收藏 0 点赞 0 评论 0
@Test
public void testSpecExample3() throws Exception {
    WsServerContainer sc =
            new WsServerContainer(new TesterServletContext());

    ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
            Object.class, "/a/{var}/c").build();
    ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
            Object.class, "/a/b/c").build();
    ServerEndpointConfig configC = ServerEndpointConfig.Builder.create(
            Object.class, "/a/{var1}/{var2}").build();

    sc.addEndpoint(configA);
    sc.addEndpoint(configB);
    sc.addEndpoint(configC);

    Assert.assertEquals(configB, sc.findMapping("/a/b/c").getConfig());
    Assert.assertEquals(configA, sc.findMapping("/a/d/c").getConfig());
    Assert.assertEquals(configC, sc.findMapping("/a/x/y").getConfig());
}
TestWsServerContainer.java 文件源码 项目:tomcat7 阅读 37 收藏 0 点赞 0 评论 0
@Test
public void testDuplicatePaths_04() throws Exception {
    WsServerContainer sc =
            new WsServerContainer(new TesterServletContext());

    ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
            Object.class, "/a/{var1}/{var2}").build();
    ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
            Object.class, "/a/b/{var2}").build();

    sc.addEndpoint(configA);
    sc.addEndpoint(configB);

    Assert.assertEquals(configA, sc.findMapping("/a/x/y").getConfig());
    Assert.assertEquals(configB, sc.findMapping("/a/b/y").getConfig());
}
TestWsRemoteEndpointImplServer.java 文件源码 项目:tomcat7 阅读 36 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    super.contextInitialized(sce);

    ServerContainer sc = (ServerContainer) sce.getServletContext().getAttribute(
            Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);

    List<Class<? extends Encoder>> encoders = new ArrayList<Class<? extends Encoder>>();
    encoders.add(Bug58624Encoder.class);
    ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(
            Bug58624Endpoint.class, PATH).encoders(encoders).build();

    try {
        sc.addEndpoint(sec);
    } catch (DeploymentException e) {
        throw new RuntimeException(e);
    }
}
TestClose.java 文件源码 项目:tomcat7 阅读 31 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    super.contextInitialized(sce);

    ServerContainer sc = (ServerContainer) sce
            .getServletContext()
            .getAttribute(
                    Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);

    ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(
            getEndpointClass(), PATH).build();

    try {
        sc.addEndpoint(sec);
    } catch (DeploymentException e) {
        throw new RuntimeException(e);
    }
}
TestWsWebSocketContainer.java 文件源码 项目:tomcat7 阅读 43 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    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.timeoutOnContainer) {
            sc.setAsyncSendTimeout(TIMEOUT_MS);
        }
    } catch (DeploymentException e) {
        throw new IllegalStateException(e);
    }
}
ExamplesConfig.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 38 收藏 0 点赞 0 评论 0
@Override
public Set<ServerEndpointConfig> getEndpointConfigs(
        Set<Class<? extends Endpoint>> scanned) {

    Set<ServerEndpointConfig> result = new HashSet<ServerEndpointConfig>();

    if (scanned.contains(EchoEndpoint.class)) {
        result.add(ServerEndpointConfig.Builder.create(
                EchoEndpoint.class,
                "/websocket/echoProgrammatic").build());
    }

    if (scanned.contains(DrawboardEndpoint.class)) {
        result.add(ServerEndpointConfig.Builder.create(
                DrawboardEndpoint.class,
                "/websocket/drawboard").build());
    }

    return result;
}
TestCloseBug58624.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 43 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    super.contextInitialized(sce);

    ServerContainer sc = (ServerContainer) sce.getServletContext().getAttribute(
            Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);

    ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(
            Bug58624ServerEndpoint.class, PATH).build();

    try {
        sc.addEndpoint(sec);
    } catch (DeploymentException e) {
        throw new RuntimeException(e);
    }
}
TestWsServerContainer.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 37 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    super.contextInitialized(sce);

    ServerContainer sc =
            (ServerContainer) sce.getServletContext().getAttribute(
                    Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);

    ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(
            TesterEchoServer.Basic.class, "/{param}").build();

    try {
        sc.addEndpoint(sec);
    } catch (DeploymentException e) {
        throw new RuntimeException(e);
    }
}
TestWsServerContainer.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 39 收藏 0 点赞 0 评论 0
@Test
public void testSpecExample3() throws Exception {
    WsServerContainer sc =
            new WsServerContainer(new TesterServletContext());

    ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
            Object.class, "/a/{var}/c").build();
    ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
            Object.class, "/a/b/c").build();
    ServerEndpointConfig configC = ServerEndpointConfig.Builder.create(
            Object.class, "/a/{var1}/{var2}").build();

    sc.addEndpoint(configA);
    sc.addEndpoint(configB);
    sc.addEndpoint(configC);

    Assert.assertEquals(configB, sc.findMapping("/a/b/c").getConfig());
    Assert.assertEquals(configA, sc.findMapping("/a/d/c").getConfig());
    Assert.assertEquals(configC, sc.findMapping("/a/x/y").getConfig());
}
TestWsServerContainer.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 36 收藏 0 点赞 0 评论 0
@Test
public void testDuplicatePaths_04() throws Exception {
    WsServerContainer sc =
            new WsServerContainer(new TesterServletContext());

    ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
            Object.class, "/a/{var1}/{var2}").build();
    ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
            Object.class, "/a/b/{var2}").build();

    sc.addEndpoint(configA);
    sc.addEndpoint(configB);

    Assert.assertEquals(configA, sc.findMapping("/a/x/y").getConfig());
    Assert.assertEquals(configB, sc.findMapping("/a/b/y").getConfig());
}
TestWsRemoteEndpointImplServer.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 30 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    super.contextInitialized(sce);

    ServerContainer sc = (ServerContainer) sce.getServletContext().getAttribute(
            Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);

    List<Class<? extends Encoder>> encoders = new ArrayList<Class<? extends Encoder>>();
    encoders.add(Bug58624Encoder.class);
    ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(
            Bug58624Endpoint.class, PATH).encoders(encoders).build();

    try {
        sc.addEndpoint(sec);
    } catch (DeploymentException e) {
        throw new RuntimeException(e);
    }
}
TestClose.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 35 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    super.contextInitialized(sce);

    ServerContainer sc = (ServerContainer) sce
            .getServletContext()
            .getAttribute(
                    Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);

    ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(
            getEndpointClass(), PATH).build();

    try {
        sc.addEndpoint(sec);
    } catch (DeploymentException e) {
        throw new RuntimeException(e);
    }
}
TestWsWebSocketContainer.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 45 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(ServletContextEvent sce) {
    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.timeoutOnContainer) {
            sc.setAsyncSendTimeout(TIMEOUT_MS);
        }
    } catch (DeploymentException e) {
        throw new IllegalStateException(e);
    }
}
ExamplesConfig.java 文件源码 项目:apache-tomcat-7.0.73-with-comment 阅读 38 收藏 0 点赞 0 评论 0
@Override
public Set<ServerEndpointConfig> getEndpointConfigs(
        Set<Class<? extends Endpoint>> scanned) {

    Set<ServerEndpointConfig> result = new HashSet<ServerEndpointConfig>();

    if (scanned.contains(EchoEndpoint.class)) {
        result.add(ServerEndpointConfig.Builder.create(
                EchoEndpoint.class,
                "/websocket/echoProgrammatic").build());
    }

    if (scanned.contains(DrawboardEndpoint.class)) {
        result.add(ServerEndpointConfig.Builder.create(
                DrawboardEndpoint.class,
                "/websocket/drawboard").build());
    }

    return result;
}
PojoEndpointServer.java 文件源码 项目:lazycat 阅读 33 收藏 0 点赞 0 评论 0
@Override
public void onOpen(Session session, EndpointConfig endpointConfig) {

    ServerEndpointConfig sec = (ServerEndpointConfig) endpointConfig;

    Object pojo;
    try {
        pojo = sec.getConfigurator().getEndpointInstance(sec.getEndpointClass());
    } catch (InstantiationException e) {
        throw new IllegalArgumentException(
                sm.getString("pojoEndpointServer.getPojoInstanceFail", sec.getEndpointClass().getName()), e);
    }
    setPojo(pojo);

    @SuppressWarnings("unchecked")
    Map<String, String> pathParameters = (Map<String, String>) sec.getUserProperties().get(POJO_PATH_PARAM_KEY);
    setPathParameters(pathParameters);

    PojoMethodMapping methodMapping = (PojoMethodMapping) sec.getUserProperties().get(POJO_METHOD_MAPPING_KEY);
    setMethodMapping(methodMapping);

    doOnOpen(session, endpointConfig);
}
CCOWContextListener.java 文件源码 项目:ccow 阅读 37 收藏 0 点赞 0 评论 0
@Override
public void contextInitialized(final ServletContextEvent servletContextEvent) {
    super.contextInitialized(servletContextEvent);
    final ServerContainer serverContainer = (ServerContainer) servletContextEvent.getServletContext()
            .getAttribute("javax.websocket.server.ServerContainer");

    if (serverContainer != null) {
        try {
            serverContainer.addEndpoint(ServerEndpointConfig.Builder
                    .create(SubscriptionEndpoint.class, "/ContextManager/{" + PATH_NAME + "}").build());
            // serverContainer.addEndpoint(ServerEndpointConfig.Builder
            // .create(ExtendedSubscriptionEndpoint.class,
            // "/ContextManager/{contextParticipantId}")
            // .configurator(new WebSocketsConfigurator()).build());
        } catch (final DeploymentException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
}
WebSocketsModule.java 文件源码 项目:ccow 阅读 50 收藏 0 点赞 0 评论 0
protected void addEndpoint(final Class<?> cls) {

    final ServerContainer container = getServerContainer();

    if (container == null) {
      LOG.warn("ServerContainer is null. Skip registration of websocket endpoint {}", cls);
      return;
    }

    try {
      LOG.debug("Register endpoint {}", cls);

      final ServerEndpointConfig config = createEndpointConfig(cls);
      container.addEndpoint(config);

    } catch (final DeploymentException e) {
      addError(e);
    }
  }
ServerEndpointExporter.java 文件源码 项目:spring4-understanding 阅读 38 收藏 0 点赞 0 评论 0
/**
 * Actually register the endpoints. Called by {@link #afterSingletonsInstantiated()}.
 */
protected void registerEndpoints() {
    Set<Class<?>> endpointClasses = new LinkedHashSet<Class<?>>();
    if (this.annotatedEndpointClasses != null) {
        endpointClasses.addAll(this.annotatedEndpointClasses);
    }

    ApplicationContext context = getApplicationContext();
    if (context != null) {
        String[] endpointBeanNames = context.getBeanNamesForAnnotation(ServerEndpoint.class);
        for (String beanName : endpointBeanNames) {
            endpointClasses.add(context.getType(beanName));
        }
    }

    for (Class<?> endpointClass : endpointClasses) {
        registerEndpoint(endpointClass);
    }

    if (context != null) {
        Map<String, ServerEndpointConfig> endpointConfigMap = context.getBeansOfType(ServerEndpointConfig.class);
        for (ServerEndpointConfig endpointConfig : endpointConfigMap.values()) {
            registerEndpoint(endpointConfig);
        }
    }
}
WSServerForIndexPage.java 文件源码 项目:tomcat-8-wffweb-demo-apps 阅读 41 收藏 0 点赞 0 评论 0
@Override
public void modifyHandshake(ServerEndpointConfig config,
        HandshakeRequest request, HandshakeResponse response) {

    HttpSession httpSession = (HttpSession) request.getHttpSession();

    super.modifyHandshake(config, request, response);

    if (httpSession == null) {
        LOGGER.info("httpSession == null after modifyHandshake");
        httpSession = (HttpSession) request.getHttpSession();
    }

    if (httpSession == null) {
        LOGGER.info("httpSession == null");
        return;
    }

    config.getUserProperties().put("httpSession", httpSession);

    httpSession = (HttpSession) request.getHttpSession();
    LOGGER.info("modifyHandshake " + httpSession.getId());

}
WebApp.java 文件源码 项目:WebCrawler 阅读 38 收藏 0 点赞 0 评论 0
@Override
public void run(AppConfiguration configuration,
                Environment environment) throws Exception {

    /* Configure WebSockets */
    ServerEndpointConfig serverEndpointConfig = ServerEndpointConfig.Builder.create(WebCrawlerEndpoint.class, "/webCrawler").build();
    serverEndpointConfig.getUserProperties().put("config", configuration.webCrawler);
    websocketBundle.addEndpoint(serverEndpointConfig);

    final FilterRegistration.Dynamic cors =
            environment.servlets().addFilter("CORS", CrossOriginFilter.class);

    /* Configure CORS parameters */
    cors.setInitParameter("allowedOrigins", "*");
    cors.setInitParameter("allowedHeaders", "*");
    cors.setInitParameter("allowedMethods", "OPTIONS,GET,PUT,POST,DELETE,HEAD");

    cors.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");

    environment.healthChecks().register("dummy", new DummyHealthCheck());
}
IntegrationTestApplication.java 文件源码 项目:dropwizard-websocket-jee7-bundle 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void run(IntegrationConfiguration configuration, Environment environment) throws Exception {
    //Annotated endpoint
    websocket.addEndpoint(PingPongServerEndpoint.class);

    //programmatic endpoint
    ServerEndpointConfig serverEndpointConfig = ServerEndpointConfig.Builder.create(ProgrammaticServerEndpoint.class, "/programmatic").build();
    websocket.addEndpoint(serverEndpointConfig);

    // healthcheck to keep output quiet
    environment.healthChecks().register("healthy", new HealthCheck() {
        @Override
        protected Result check() throws Exception {
            return Result.healthy();
        }
    });

    initLatch.countDown();
}
LifecycleManager.java 文件源码 项目:gameon-room 阅读 40 收藏 0 点赞 0 评论 0
@Override
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
    super.modifyHandshake(sec, request, response);

    if ( token == null || token.isEmpty() ) {
        Log.log(Level.FINEST, this, "No token set for room, skipping validation");
    } else {
        Log.log(Level.FINEST, this, "Validating WS handshake");
        SignedRequestHmac wsHmac = new SignedRequestHmac("", token, "", request.getRequestURI().getRawPath());

        try {
            wsHmac.checkHeaders(new SignedRequestMap.MLS_StringMap(request.getHeaders()))
                    .verifyFullSignature()
                    .wsResignRequest(new SignedRequestMap.MLS_StringMap(response.getHeaders()));

            Log.log(Level.INFO, this, "validated and resigned", wsHmac);
        } catch(Exception e) {
            Log.log(Level.WARNING, this, "Failed to validate HMAC, unable to establish connection", e);

            response.getHeaders().replace(HandshakeResponse.SEC_WEBSOCKET_ACCEPT, Collections.emptyList());
        }
    }
}
LifecycleManager.java 文件源码 项目:gameon-room 阅读 37 收藏 0 点赞 0 评论 0
private Set<ServerEndpointConfig> registerRooms(Collection<Room> rooms) {

        Set<ServerEndpointConfig> endpoints = new HashSet<ServerEndpointConfig>();
        for (Room room : rooms) {

            RoomRegistrationHandler roomRegistration = new RoomRegistrationHandler(room, systemId, registrationSecret);
            try{
                roomRegistration.performRegistration();
            }catch(Exception e){
                Log.log(Level.SEVERE, this, "Room Registration FAILED", e);
                //we keep running, maybe we were registered ok before...
            }

            //now regardless of our registration, open our websocket.
            SessionRoomResponseProcessor srrp = new SessionRoomResponseProcessor();
            ServerEndpointConfig.Configurator config = new RoomWSConfig(room, srrp, roomRegistration.getToken());

            endpoints.add(ServerEndpointConfig.Builder.create(RoomWS.class, "/ws/" + room.getRoomId())
                    .configurator(config).build());
        }

        return endpoints;
    }
JwaServerWebSocketTest.java 文件源码 项目:asity 阅读 34 收藏 0 点赞 0 评论 0
@Override
protected void startServer(int port, final Action<ServerWebSocket> websocketAction) throws
  Exception {
  server = new Server();
  ServerConnector connector = new ServerConnector(server);
  connector.setPort(port);
  server.addConnector(connector);
  ServletContextHandler handler = new ServletContextHandler();
  server.setHandler(handler);
  ServerContainer container = WebSocketServerContainerInitializer.configureContext(handler);
  ServerEndpointConfig config = ServerEndpointConfig.Builder.create(AsityServerEndpoint.class,
    TEST_URI)
  .configurator(new Configurator() {
    @Override
    public <T> T getEndpointInstance(Class<T> endpointClass) throws InstantiationException {
      return endpointClass.cast(new AsityServerEndpoint().onwebsocket(websocketAction));
    }
  })
  .build();
  container.addEndpoint(config);
  server.start();
}
ServerContainerInitializeListener.java 文件源码 项目:che 阅读 30 收藏 0 点赞 0 评论 0
protected ServerEndpointConfig createWsServerEndpointConfig(ServletContext servletContext) {
  final List<Class<? extends Encoder>> encoders = new LinkedList<>();
  final List<Class<? extends Decoder>> decoders = new LinkedList<>();
  encoders.add(OutputMessageEncoder.class);
  decoders.add(InputMessageDecoder.class);
  final ServerEndpointConfig endpointConfig =
      create(CheWSConnection.class, websocketContext + websocketEndPoint)
          .configurator(createConfigurator())
          .encoders(encoders)
          .decoders(decoders)
          .build();
  endpointConfig
      .getUserProperties()
      .put(EVERREST_PROCESSOR_ATTRIBUTE, getEverrestProcessor(servletContext));
  endpointConfig
      .getUserProperties()
      .put(EVERREST_CONFIG_ATTRIBUTE, getEverrestConfiguration(servletContext));
  endpointConfig.getUserProperties().put(EXECUTOR_ATTRIBUTE, createExecutor(servletContext));
  return endpointConfig;
}
ServerContainerInitializeListener.java 文件源码 项目:che 阅读 32 收藏 0 点赞 0 评论 0
protected ServerEndpointConfig createEventbusServerEndpointConfig(ServletContext servletContext) {
  final List<Class<? extends Encoder>> encoders = new LinkedList<>();
  final List<Class<? extends Decoder>> decoders = new LinkedList<>();
  encoders.add(OutputMessageEncoder.class);
  decoders.add(InputMessageDecoder.class);
  final ServerEndpointConfig endpointConfig =
      create(CheWSConnection.class, websocketContext + eventBusEndPoint)
          .configurator(createConfigurator())
          .encoders(encoders)
          .decoders(decoders)
          .build();
  endpointConfig
      .getUserProperties()
      .put(EVERREST_PROCESSOR_ATTRIBUTE, getEverrestProcessor(servletContext));
  endpointConfig
      .getUserProperties()
      .put(EVERREST_CONFIG_ATTRIBUTE, getEverrestConfiguration(servletContext));
  endpointConfig.getUserProperties().put(EXECUTOR_ATTRIBUTE, createExecutor(servletContext));
  return endpointConfig;
}


问题


面经


文章

微信
公众号

扫码关注公众号