org.springframework.web.socket.SubProtocolCapable Java Examples

The following examples show how to use org.springframework.web.socket.SubProtocolCapable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractHandshakeHandler.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * 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());
}
 
Example #2
Source File: SockJsWebSocketHandler.java    From spring-analysis-note with MIT License 5 votes vote down vote up
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());
}
 
Example #3
Source File: AbstractHandshakeHandler.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * 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());
}
 
Example #4
Source File: SockJsWebSocketHandler.java    From java-technology-stack with MIT License 5 votes vote down vote up
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());
}
 
Example #5
Source File: AbstractHandshakeHandler.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * 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.<String>emptyList());
}
 
Example #6
Source File: SockJsWebSocketHandler.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
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<String>(((SubProtocolCapable) webSocketHandler).getSubProtocols()) : null);
}