parent
8053fefea8
commit
a90e4b230f
|
|
@ -44,10 +44,12 @@ public interface TransportHandler {
|
|||
TransportType getTransportType();
|
||||
|
||||
/**
|
||||
* Whether the type of the given session matches the transport type of this
|
||||
* {@code TransportHandler} where session id and the transport type are
|
||||
* extracted from the SockJS URL.
|
||||
* @since 4.3.3
|
||||
* Check whether the type of the given session matches the transport type
|
||||
* of this {@code TransportHandler} where session id and the transport type
|
||||
* are extracted from the SockJS URL.
|
||||
* @return {@code true} if the session matches (and would therefore get
|
||||
* accepted by {@link #handleRequest}), or {@code false} otherwise
|
||||
* @since 4.3.4
|
||||
*/
|
||||
boolean checkSessionType(SockJsSession session);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ import org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJ
|
|||
*/
|
||||
public abstract class AbstractHttpReceivingTransportHandler extends AbstractTransportHandler {
|
||||
|
||||
@Override
|
||||
public boolean checkSessionType(SockJsSession session) {
|
||||
return (session instanceof AbstractHttpSockJsSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response,
|
||||
|
|
@ -95,13 +99,9 @@ public abstract class AbstractHttpReceivingTransportHandler extends AbstractTran
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected abstract String[] readMessages(ServerHttpRequest request) throws IOException;
|
||||
|
||||
protected abstract HttpStatus getResponseStatus();
|
||||
|
||||
@Override
|
||||
public boolean checkSessionType(SockJsSession session) {
|
||||
return session instanceof AbstractHttpSockJsSession;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,14 @@ import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
|
|||
import org.springframework.web.socket.sockjs.transport.TransportHandler;
|
||||
|
||||
/**
|
||||
* Common base class for {@link TransportHandler} inplementations.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.0
|
||||
*/
|
||||
public abstract class AbstractTransportHandler implements TransportHandler {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(this.getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private SockJsServiceConfig serviceConfig;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue