Example usage for org.springframework.web.socket.server.support WebSocketHttpRequestHandler WebSocketHttpRequestHandler

List of usage examples for org.springframework.web.socket.server.support WebSocketHttpRequestHandler WebSocketHttpRequestHandler

Introduction

In this page you can find the example usage for org.springframework.web.socket.server.support WebSocketHttpRequestHandler WebSocketHttpRequestHandler.

Prototype

public WebSocketHttpRequestHandler(WebSocketHandler wsHandler, HandshakeHandler handshakeHandler) 

Source Link

Usage

From source file:ch.rasc.wampspring.config.WebMvcWampWebSocketEndpointRegistration.java

public final MultiValueMap<HttpRequestHandler, String> getMappings() {
    MultiValueMap<HttpRequestHandler, String> mappings = new LinkedMultiValueMap<>();
    if (this.registration != null) {
        SockJsService sockJsService = this.registration.getSockJsService();
        for (String path : this.paths) {
            String pattern = path.endsWith("/") ? path + "**" : path + "/**";
            SockJsHttpRequestHandler handler = new SockJsHttpRequestHandler(sockJsService,
                    this.webSocketHandler);
            mappings.add(handler, pattern);
        }/*w  ww. j a  v a2 s. c om*/
    } else {
        for (String path : this.paths) {
            WebSocketHttpRequestHandler handler;
            if (this.handshakeHandler != null) {
                handler = new WebSocketHttpRequestHandler(this.webSocketHandler, this.handshakeHandler);
            } else {
                handler = new WebSocketHttpRequestHandler(this.webSocketHandler);
            }
            HandshakeInterceptor[] handshakeInterceptors = getInterceptors();
            if (handshakeInterceptors.length > 0) {
                handler.setHandshakeInterceptors(Arrays.asList(handshakeInterceptors));
            }
            mappings.add(handler, path);
        }
    }
    return mappings;
}