Fix a package tangle between SockJS support and transport packages
Issue: SPR-12379
This commit is contained in:
@@ -46,7 +46,6 @@ import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.sockjs.SockJsException;
|
||||
import org.springframework.web.socket.sockjs.SockJsService;
|
||||
import org.springframework.web.socket.sockjs.transport.TransportType;
|
||||
|
||||
/**
|
||||
* An abstract base class for {@link SockJsService} implementations that provides SockJS
|
||||
@@ -379,12 +378,6 @@ public abstract class AbstractSockJsService implements SockJsService {
|
||||
response.setStatusCode(HttpStatus.NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
else if(!this.allowedOrigins.contains("*") && !TransportType.fromValue(transport).supportsOrigin()) {
|
||||
logger.debug("Origin check has been enabled, but this transport does not support it, ignoring "
|
||||
+ requestInfo);
|
||||
response.setStatusCode(HttpStatus.NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
handleTransportRequest(request, response, wsHandler, sessionId, transport);
|
||||
}
|
||||
response.close();
|
||||
|
||||
@@ -273,6 +273,15 @@ public class TransportHandlingSockJsService extends AbstractSockJsService implem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateRequest(String serverId, String sessionId, String transport) {
|
||||
if(!this.getAllowedOrigins().contains("*") && !TransportType.fromValue(transport).supportsOrigin()) {
|
||||
logger.error("Origin check has been enabled, but this transport does not support it");
|
||||
return false;
|
||||
}
|
||||
return super.validateRequest(serverId, sessionId, transport);
|
||||
}
|
||||
|
||||
private SockJsSession createSockJsSession(String sessionId, SockJsSessionFactory sessionFactory,
|
||||
WebSocketHandler handler, Map<String, Object> attributes) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user