|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -29,10 +29,10 @@ import org.springframework.messaging.simp.config.MessageBrokerRegistry; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A {@link WebSocketMessageBrokerConfigurationSupport} extension that detects beans of type |
|
|
|
* A {@link WebSocketMessageBrokerConfigurationSupport} extension that detects |
|
|
|
* {@link WebSocketMessageBrokerConfigurer} |
|
|
|
* beans of type {@link WebSocketMessageBrokerConfigurer} and delegates to all |
|
|
|
* and delegates to all of them allowing callback style customization of the |
|
|
|
* of them allowing callback style customization of the configuration provided |
|
|
|
* configuration provided in {@link WebSocketMessageBrokerConfigurationSupport}. |
|
|
|
* in {@link WebSocketMessageBrokerConfigurationSupport}. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>This class is typically imported via {@link EnableWebSocketMessageBroker}. |
|
|
|
* <p>This class is typically imported via {@link EnableWebSocketMessageBroker}. |
|
|
|
* |
|
|
|
* |
|
|
|
@ -42,7 +42,7 @@ import org.springframework.util.CollectionUtils; |
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMessageBrokerConfigurationSupport { |
|
|
|
public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMessageBrokerConfigurationSupport { |
|
|
|
|
|
|
|
|
|
|
|
private List<WebSocketMessageBrokerConfigurer> configurers = new ArrayList<WebSocketMessageBrokerConfigurer>(); |
|
|
|
private final List<WebSocketMessageBrokerConfigurer> configurers = new ArrayList<WebSocketMessageBrokerConfigurer>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired(required = false) |
|
|
|
@Autowired(required = false) |
|
|
|
@ -55,51 +55,51 @@ public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMess |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void registerStompEndpoints(StompEndpointRegistry registry) { |
|
|
|
protected void registerStompEndpoints(StompEndpointRegistry registry) { |
|
|
|
for (WebSocketMessageBrokerConfigurer c : this.configurers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) { |
|
|
|
c.registerStompEndpoints(registry); |
|
|
|
configurer.registerStompEndpoints(registry); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void configureWebSocketTransport(WebSocketTransportRegistration registration) { |
|
|
|
protected void configureWebSocketTransport(WebSocketTransportRegistration registration) { |
|
|
|
for (WebSocketMessageBrokerConfigurer c : this.configurers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) { |
|
|
|
c.configureWebSocketTransport(registration); |
|
|
|
configurer.configureWebSocketTransport(registration); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void configureClientInboundChannel(ChannelRegistration registration) { |
|
|
|
protected void configureClientInboundChannel(ChannelRegistration registration) { |
|
|
|
for (WebSocketMessageBrokerConfigurer c : this.configurers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) { |
|
|
|
c.configureClientInboundChannel(registration); |
|
|
|
configurer.configureClientInboundChannel(registration); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void configureClientOutboundChannel(ChannelRegistration registration) { |
|
|
|
protected void configureClientOutboundChannel(ChannelRegistration registration) { |
|
|
|
for (WebSocketMessageBrokerConfigurer c : this.configurers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) { |
|
|
|
c.configureClientOutboundChannel(registration); |
|
|
|
configurer.configureClientOutboundChannel(registration); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { |
|
|
|
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer c : this.configurers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) { |
|
|
|
c.addArgumentResolvers(argumentResolvers); |
|
|
|
configurer.addArgumentResolvers(argumentResolvers); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) { |
|
|
|
protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer c : this.configurers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) { |
|
|
|
c.addReturnValueHandlers(returnValueHandlers); |
|
|
|
configurer.addReturnValueHandlers(returnValueHandlers); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected boolean configureMessageConverters(List<MessageConverter> messageConverters) { |
|
|
|
protected boolean configureMessageConverters(List<MessageConverter> messageConverters) { |
|
|
|
boolean registerDefaults = true; |
|
|
|
boolean registerDefaults = true; |
|
|
|
for (WebSocketMessageBrokerConfigurer c : this.configurers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) { |
|
|
|
if (!c.configureMessageConverters(messageConverters)) { |
|
|
|
if (!configurer.configureMessageConverters(messageConverters)) { |
|
|
|
registerDefaults = false; |
|
|
|
registerDefaults = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -108,8 +108,8 @@ public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMess |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void configureMessageBroker(MessageBrokerRegistry registry) { |
|
|
|
protected void configureMessageBroker(MessageBrokerRegistry registry) { |
|
|
|
for (WebSocketMessageBrokerConfigurer c : this.configurers) { |
|
|
|
for (WebSocketMessageBrokerConfigurer configurer : this.configurers) { |
|
|
|
c.configureMessageBroker(registry); |
|
|
|
configurer.configureMessageBroker(registry); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|