Skip to content

Commit a90e4b2

Browse files
committed
Polishing
Issue: SPR-14867
1 parent 8053fef commit a90e4b2

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/TransportHandler.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ public interface TransportHandler {
4444
TransportType getTransportType();
4545

4646
/**
47-
* Whether the type of the given session matches the transport type of this
48-
* {@code TransportHandler} where session id and the transport type are
49-
* extracted from the SockJS URL.
50-
* @since 4.3.3
47+
* Check whether the type of the given session matches the transport type
48+
* of this {@code TransportHandler} where session id and the transport type
49+
* are extracted from the SockJS URL.
50+
* @return {@code true} if the session matches (and would therefore get
51+
* accepted by {@link #handleRequest}), or {@code false} otherwise
52+
* @since 4.3.4
5153
*/
5254
boolean checkSessionType(SockJsSession session);
5355

spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/AbstractHttpReceivingTransportHandler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
*/
3939
public abstract class AbstractHttpReceivingTransportHandler extends AbstractTransportHandler {
4040

41+
@Override
42+
public boolean checkSessionType(SockJsSession session) {
43+
return (session instanceof AbstractHttpSockJsSession);
44+
}
4145

4246
@Override
4347
public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response,
@@ -95,13 +99,9 @@ private void handleReadError(ServerHttpResponse response, String error, String s
9599
}
96100
}
97101

102+
98103
protected abstract String[] readMessages(ServerHttpRequest request) throws IOException;
99104

100105
protected abstract HttpStatus getResponseStatus();
101106

102-
@Override
103-
public boolean checkSessionType(SockJsSession session) {
104-
return session instanceof AbstractHttpSockJsSession;
105-
}
106-
107107
}

spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/AbstractTransportHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323
import org.springframework.web.socket.sockjs.transport.TransportHandler;
2424

2525
/**
26+
* Common base class for {@link TransportHandler} inplementations.
27+
*
2628
* @author Rossen Stoyanchev
2729
* @since 4.0
2830
*/
2931
public abstract class AbstractTransportHandler implements TransportHandler {
3032

31-
protected final Log logger = LogFactory.getLog(this.getClass());
33+
protected final Log logger = LogFactory.getLog(getClass());
3234

3335
private SockJsServiceConfig serviceConfig;
3436

0 commit comments

Comments
 (0)