Skip to content

Commit 0554797

Browse files
committed
Polishing
Issue: SPR-14867 (cherry picked from commit a90e4b2)
1 parent 9e67ba8 commit 0554797

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,10 @@
3737
*/
3838
public abstract class AbstractHttpReceivingTransportHandler extends AbstractTransportHandler {
3939

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

4145
@Override
4246
public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response,
@@ -94,13 +98,9 @@ private void handleReadError(ServerHttpResponse response, String error, String s
9498
}
9599
}
96100

101+
97102
protected abstract String[] readMessages(ServerHttpRequest request) throws IOException;
98103

99104
protected abstract HttpStatus getResponseStatus();
100105

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

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,15 +25,16 @@
2525
import org.springframework.web.socket.sockjs.transport.TransportHandler;
2626

2727
/**
28+
* Common base class for {@link TransportHandler} inplementations.
29+
*
2830
* @author Rossen Stoyanchev
2931
* @since 4.0
3032
*/
3133
public abstract class AbstractTransportHandler implements TransportHandler {
3234

3335
protected static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
3436

35-
36-
protected final Log logger = LogFactory.getLog(this.getClass());
37+
protected final Log logger = LogFactory.getLog(getClass());
3738

3839
private SockJsServiceConfig serviceConfig;
3940

0 commit comments

Comments
 (0)