Example usage for org.springframework.web.socket.handler WebSocketHandlerDecorator unwrap

List of usage examples for org.springframework.web.socket.handler WebSocketHandlerDecorator unwrap

Introduction

In this page you can find the example usage for org.springframework.web.socket.handler WebSocketHandlerDecorator unwrap.

Prototype

public static WebSocketHandler unwrap(WebSocketHandler handler) 

Source Link

Usage

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

private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler wsHandler) {
    WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(wsHandler);
    Assert.isInstanceOf(SubProtocolWebSocketHandler.class, actual,
            "No SubProtocolWebSocketHandler in " + wsHandler);
    return (SubProtocolWebSocketHandler) actual;
}

From source file:org.springframework.web.socket.server.support.AbstractHandshakeHandler.java

/**
 * Determine the sub-protocols supported by the given WebSocketHandler by
 * checking whether it is an instance of {@link SubProtocolCapable}.
 * @param handler the handler to check//  w ww .  jav a  2  s . c  o m
 * @return a list of supported protocols, or an empty list if none available
 */
protected final List<String> determineHandlerSupportedProtocols(WebSocketHandler handler) {
    WebSocketHandler handlerToCheck = WebSocketHandlerDecorator.unwrap(handler);
    List<String> subProtocols = null;
    if (handlerToCheck instanceof SubProtocolCapable) {
        subProtocols = ((SubProtocolCapable) handlerToCheck).getSubProtocols();
    }
    return (subProtocols != null ? subProtocols : Collections.emptyList());
}

From source file:org.springframework.web.socket.server.support.DefaultHandshakeHandler.java

/**
 * Determine the sub-protocols supported by the given WebSocketHandler by
 * checking whether it is an instance of {@link SubProtocolCapable}.
 * @param handler the handler to check/*w  ww .ja v  a  2 s.  c om*/
 * @return a list of supported protocols, or an empty list if none available
 */
protected final List<String> determineHandlerSupportedProtocols(WebSocketHandler handler) {
    WebSocketHandler handlerToCheck = WebSocketHandlerDecorator.unwrap(handler);
    List<String> subProtocols = null;
    if (handlerToCheck instanceof SubProtocolCapable) {
        subProtocols = ((SubProtocolCapable) handlerToCheck).getSubProtocols();
    }
    return (subProtocols != null ? subProtocols : Collections.<String>emptyList());
}