Fix SubProtocolHandler duplicate registration
Prior to this change, duplicate SubProtocolHandlers could be registered
when configuring STOMP with several registrations:
public void registerStompEndpoints
(final StompEndpointRegistry registry) {
this.endpointRegistry.addEndpoint("/stompOverWebSocket");
this.endpointRegistry.addEndpoint("/stompOverSockJS").withSockJS();
}
This commit registers sub-protocols in a Set instead of a list (see
SubProtocolWebSocketHandler), thus fixing the issue.
Issue: SPR-12403
This commit is contained in:
@@ -84,6 +84,9 @@ public class WebMvcStompEndpointRegistryTests {
|
||||
this.endpointRegistry.addEndpoint("/stompOverWebSocket");
|
||||
this.endpointRegistry.addEndpoint("/stompOverSockJS").withSockJS();
|
||||
|
||||
//SPR-12403
|
||||
assertEquals(1, this.webSocketHandler.getProtocolHandlers().size());
|
||||
|
||||
hm = (SimpleUrlHandlerMapping) this.endpointRegistry.getHandlerMapping();
|
||||
assertEquals(2, hm.getUrlMap().size());
|
||||
assertNotNull(hm.getUrlMap().get("/stompOverWebSocket"));
|
||||
|
||||
Reference in New Issue
Block a user