private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler handler) { WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(handler); if (!(actual instanceof SubProtocolWebSocketHandler)) { throw new IllegalArgumentException("No SubProtocolWebSocketHandler in " + handler); } return (SubProtocolWebSocketHandler) actual; }
public SockJsWebSocketHandler(SockJsServiceConfig serviceConfig, WebSocketHandler webSocketHandler, WebSocketServerSockJsSession sockJsSession) { Assert.notNull(serviceConfig, "serviceConfig must not be null"); Assert.notNull(webSocketHandler, "webSocketHandler must not be null"); Assert.notNull(sockJsSession, "session must not be null"); this.sockJsServiceConfig = serviceConfig; this.sockJsSession = sockJsSession; webSocketHandler = WebSocketHandlerDecorator.unwrap(webSocketHandler); this.subProtocols = ((webSocketHandler instanceof SubProtocolCapable) ? new ArrayList<>(((SubProtocolCapable) webSocketHandler).getSubProtocols()) : Collections.emptyList()); }
/** * 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 * @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()); }
private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler handler) { WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(handler); if (!(actual instanceof SubProtocolWebSocketHandler)) { throw new IllegalArgumentException("No SubProtocolWebSocketHandler in " + handler); } return (SubProtocolWebSocketHandler) actual; }
private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler( WebSocketHandler wsHandler) { WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(wsHandler); Assert.isInstanceOf(SubProtocolWebSocketHandler.class, actual, "No SubProtocolWebSocketHandler in " + wsHandler); return (SubProtocolWebSocketHandler) actual; }
private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler handler) { WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(handler); if (!(actual instanceof SubProtocolWebSocketHandler)) { throw new IllegalArgumentException("No SubProtocolWebSocketHandler in " + handler); } return (SubProtocolWebSocketHandler) actual; }
public SockJsWebSocketHandler(SockJsServiceConfig serviceConfig, WebSocketHandler webSocketHandler, WebSocketServerSockJsSession sockJsSession) { Assert.notNull(serviceConfig, "serviceConfig must not be null"); Assert.notNull(webSocketHandler, "webSocketHandler must not be null"); Assert.notNull(sockJsSession, "session must not be null"); this.sockJsServiceConfig = serviceConfig; this.sockJsSession = sockJsSession; webSocketHandler = WebSocketHandlerDecorator.unwrap(webSocketHandler); this.subProtocols = ((webSocketHandler instanceof SubProtocolCapable) ? new ArrayList<>(((SubProtocolCapable) webSocketHandler).getSubProtocols()) : Collections.emptyList()); }
public SockJsWebSocketHandler(SockJsServiceConfig serviceConfig, WebSocketHandler webSocketHandler, WebSocketServerSockJsSession sockJsSession) { Assert.notNull(serviceConfig, "serviceConfig must not be null"); Assert.notNull(webSocketHandler, "webSocketHandler must not be null"); Assert.notNull(sockJsSession, "session must not be null"); this.sockJsServiceConfig = serviceConfig; this.sockJsSession = sockJsSession; webSocketHandler = WebSocketHandlerDecorator.unwrap(webSocketHandler); this.subProtocols = ((webSocketHandler instanceof SubProtocolCapable) ? new ArrayList<>(((SubProtocolCapable) webSocketHandler).getSubProtocols()) : Collections.emptyList()); }
/** * 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 * @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()); }
/** * 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 * @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()); }