diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java b/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java index 6c691af57f..3dbccf3a3e 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ package org.springframework.web.socket.sockjs.transport.session; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; @@ -26,6 +26,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledFuture; +import java.util.stream.Collectors; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -58,7 +59,7 @@ public abstract class AbstractSockJsSession implements SockJsSession { /** * Log category to use on network IO exceptions after a client has gone away. - *
Servlet containers dn't expose a a client disconnected callback, see + *
Servlet containers don't expose a client disconnected callback; see
* eclipse-ee4j/servlet-api#44.
* Therefore network IO failures may occur simply because a client has gone away,
* and that can fill the logs with unnecessary stack traces.
@@ -121,7 +122,7 @@ public abstract class AbstractSockJsSession implements SockJsSession {
* @param id the session ID
* @param config the SockJS service configuration options
* @param handler the recipient of SockJS messages
- * @param attributes attributes from the HTTP handshake to associate with the WebSocket
+ * @param attributes the attributes from the HTTP handshake to associate with the WebSocket
* session; the provided attributes are copied, the original map is not used.
*/
public AbstractSockJsSession(String id, SockJsServiceConfig config, WebSocketHandler handler,
@@ -162,6 +163,7 @@ public abstract class AbstractSockJsSession implements SockJsSession {
// Message sending
+ @Override
public final void sendMessage(WebSocketMessage> message) throws IOException {
Assert.state(!isClosed(), "Cannot send a message when session is closed");
Assert.isInstanceOf(TextMessage.class, message, "SockJS supports text messages only");
@@ -376,20 +378,45 @@ public abstract class AbstractSockJsSession implements SockJsSession {
}
public void delegateMessages(String... messages) throws SockJsMessageDeliveryException {
- List