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