Search in sources :

Example 1 with SockJsServiceRegistration

use of org.springframework.web.socket.config.annotation.SockJsServiceRegistration in project spring-integration by spring-projects.

the class ServerWebSocketContainer method registerWebSocketHandlers.

@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
    WebSocketHandler webSocketHandler = this.webSocketHandler;
    if (this.decoratorFactories != null) {
        for (WebSocketHandlerDecoratorFactory factory : this.decoratorFactories) {
            webSocketHandler = factory.decorate(webSocketHandler);
        }
    }
    WebSocketHandlerRegistration registration = registry.addHandler(webSocketHandler, this.paths).setHandshakeHandler(this.handshakeHandler).addInterceptors(this.interceptors).setAllowedOrigins(this.origins);
    if (this.sockJsServiceOptions != null) {
        SockJsServiceRegistration sockJsServiceRegistration = registration.withSockJS();
        if (this.sockJsServiceOptions.webSocketEnabled != null) {
            sockJsServiceRegistration.setWebSocketEnabled(this.sockJsServiceOptions.webSocketEnabled);
        }
        if (this.sockJsServiceOptions.clientLibraryUrl != null) {
            sockJsServiceRegistration.setClientLibraryUrl(this.sockJsServiceOptions.clientLibraryUrl);
        }
        if (this.sockJsServiceOptions.disconnectDelay != null) {
            sockJsServiceRegistration.setDisconnectDelay(this.sockJsServiceOptions.disconnectDelay);
        }
        if (this.sockJsServiceOptions.heartbeatTime != null) {
            sockJsServiceRegistration.setHeartbeatTime(this.sockJsServiceOptions.heartbeatTime);
        }
        if (this.sockJsServiceOptions.httpMessageCacheSize != null) {
            sockJsServiceRegistration.setHttpMessageCacheSize(this.sockJsServiceOptions.httpMessageCacheSize);
        }
        if (this.sockJsServiceOptions.heartbeatTime != null) {
            sockJsServiceRegistration.setHeartbeatTime(this.sockJsServiceOptions.heartbeatTime);
        }
        if (this.sockJsServiceOptions.sessionCookieNeeded != null) {
            sockJsServiceRegistration.setSessionCookieNeeded(this.sockJsServiceOptions.sessionCookieNeeded);
        }
        if (this.sockJsServiceOptions.streamBytesLimit != null) {
            sockJsServiceRegistration.setStreamBytesLimit(this.sockJsServiceOptions.streamBytesLimit);
        }
        if (this.sockJsServiceOptions.transportHandlers != null) {
            sockJsServiceRegistration.setTransportHandlers(this.sockJsServiceOptions.transportHandlers);
        }
        if (this.sockJsServiceOptions.taskScheduler != null) {
            sockJsServiceRegistration.setTaskScheduler(this.sockJsServiceOptions.taskScheduler);
        }
        if (this.sockJsServiceOptions.messageCodec != null) {
            sockJsServiceRegistration.setMessageCodec(this.sockJsServiceOptions.messageCodec);
        }
        if (this.sockJsServiceOptions.suppressCors != null) {
            sockJsServiceRegistration.setSupressCors(this.sockJsServiceOptions.suppressCors);
        }
    }
}
Also used : SockJsServiceRegistration(org.springframework.web.socket.config.annotation.SockJsServiceRegistration) WebSocketHandler(org.springframework.web.socket.WebSocketHandler) WebSocketHandlerDecoratorFactory(org.springframework.web.socket.handler.WebSocketHandlerDecoratorFactory) WebSocketHandlerRegistration(org.springframework.web.socket.config.annotation.WebSocketHandlerRegistration)

Aggregations

WebSocketHandler (org.springframework.web.socket.WebSocketHandler)1 SockJsServiceRegistration (org.springframework.web.socket.config.annotation.SockJsServiceRegistration)1 WebSocketHandlerRegistration (org.springframework.web.socket.config.annotation.WebSocketHandlerRegistration)1 WebSocketHandlerDecoratorFactory (org.springframework.web.socket.handler.WebSocketHandlerDecoratorFactory)1