Browse Source

Merged web.socket.messaging.config into web.socket.config and introduced web.socket.config.annotation

pull/423/head
Juergen Hoeller 11 years ago
parent
commit
e62cd84ca2
  1. 5
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/AbstractWebSocketHandlerRegistration.java
  2. 7
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/DelegatingWebSocketConfiguration.java
  3. 7
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.java
  4. 3
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/EnableWebSocket.java
  5. 3
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/EnableWebSocketMessageBroker.java
  6. 3
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/ServletWebSocketHandlerRegistration.java
  7. 15
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/ServletWebSocketHandlerRegistry.java
  8. 4
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/SockJsServiceRegistration.java
  9. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/StompEndpointRegistry.java
  10. 3
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/StompWebSocketEndpointRegistration.java
  11. 13
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistry.java
  12. 5
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebMvcStompWebSocketEndpointRegistration.java
  13. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketConfigurationSupport.java
  14. 4
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketConfigurer.java
  15. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketHandlerRegistration.java
  16. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketHandlerRegistry.java
  17. 6
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketMessageBrokerConfigurationSupport.java
  18. 4
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketMessageBrokerConfigurer.java
  19. 21
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/package-info.java
  20. 21
      spring-websocket/src/main/java/org/springframework/web/socket/messaging/package-info.java
  21. 6
      spring-websocket/src/test/java/org/springframework/web/socket/WebSocketIntegrationTests.java
  22. 3
      spring-websocket/src/test/java/org/springframework/web/socket/config/AbstractWebSocketHandlerRegistrationTests.java
  23. 6
      spring-websocket/src/test/java/org/springframework/web/socket/config/WebMvcStompEndpointRegistrationTests.java
  24. 7
      spring-websocket/src/test/java/org/springframework/web/socket/config/WebMvcStompEndpointRegistryTests.java
  25. 3
      spring-websocket/src/test/java/org/springframework/web/socket/config/WebSocketConfigurationTests.java
  26. 18
      spring-websocket/src/test/java/org/springframework/web/socket/config/WebSocketMessageBrokerConfigurationSupportTests.java
  27. 6
      spring-websocket/src/test/java/org/springframework/web/socket/messaging/SimpAnnotationMethodIntegrationTests.java

5
spring-websocket/src/main/java/org/springframework/web/socket/config/AbstractWebSocketHandlerRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/AbstractWebSocketHandlerRegistration.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.config; package org.springframework.web.socket.config.annotation;
import java.util.Arrays; import java.util.Arrays;
@ -103,8 +103,7 @@ public abstract class AbstractWebSocketHandlerRegistration<M> implements WebSock
return this.sockJsServiceRegistration; return this.sockJsServiceRegistration;
} }
final M getMappings() { public final M getMappings() {
M mappings = createMappings(); M mappings = createMappings();
if (this.sockJsServiceRegistration != null) { if (this.sockJsServiceRegistration != null) {

7
spring-websocket/src/main/java/org/springframework/web/socket/config/DelegatingWebSocketConfiguration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/DelegatingWebSocketConfiguration.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.config; package org.springframework.web.socket.config.annotation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -39,10 +39,9 @@ public class DelegatingWebSocketConfiguration extends WebSocketConfigurationSupp
@Autowired(required = false) @Autowired(required = false)
public void setConfigurers(List<WebSocketConfigurer> configurers) { public void setConfigurers(List<WebSocketConfigurer> configurers) {
if (CollectionUtils.isEmpty(configurers)) { if (!CollectionUtils.isEmpty(configurers)) {
return; this.configurers.addAll(configurers);
} }
this.configurers.addAll(configurers);
} }

7
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/DelegatingWebSocketMessageBrokerConfiguration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config.annotation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -44,10 +44,9 @@ public class DelegatingWebSocketMessageBrokerConfiguration extends WebSocketMess
@Autowired(required=false) @Autowired(required=false)
public void setConfigurers(List<WebSocketMessageBrokerConfigurer> configurers) { public void setConfigurers(List<WebSocketMessageBrokerConfigurer> configurers) {
if (CollectionUtils.isEmpty(configurers)) { if (!CollectionUtils.isEmpty(configurers)) {
return; this.configurers.addAll(configurers);
} }
this.configurers.addAll(configurers);
} }

3
spring-websocket/src/main/java/org/springframework/web/socket/config/EnableWebSocket.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/EnableWebSocket.java

@ -10,7 +10,8 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License. * specific language governing permissions and limitations under the License.
*/ */
package org.springframework.web.socket.config;
package org.springframework.web.socket.config.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;

3
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/EnableWebSocketMessageBroker.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/EnableWebSocketMessageBroker.java

@ -10,7 +10,8 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License. * specific language governing permissions and limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config;
package org.springframework.web.socket.config.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;

3
spring-websocket/src/main/java/org/springframework/web/socket/config/ServletWebSocketHandlerRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/ServletWebSocketHandlerRegistration.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.config; package org.springframework.web.socket.config.annotation;
import java.util.Arrays; import java.util.Arrays;
@ -40,7 +40,6 @@ import org.springframework.web.socket.sockjs.SockJsService;
public class ServletWebSocketHandlerRegistration public class ServletWebSocketHandlerRegistration
extends AbstractWebSocketHandlerRegistration<MultiValueMap<HttpRequestHandler, String>> { extends AbstractWebSocketHandlerRegistration<MultiValueMap<HttpRequestHandler, String>> {
public ServletWebSocketHandlerRegistration(TaskScheduler sockJsTaskScheduler) { public ServletWebSocketHandlerRegistration(TaskScheduler sockJsTaskScheduler) {
super(sockJsTaskScheduler); super(sockJsTaskScheduler);
} }

15
spring-websocket/src/main/java/org/springframework/web/socket/config/ServletWebSocketHandlerRegistry.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/ServletWebSocketHandlerRegistry.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.config; package org.springframework.web.socket.config.annotation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -51,16 +51,17 @@ public class ServletWebSocketHandlerRegistry implements WebSocketHandlerRegistry
@Override @Override
public WebSocketHandlerRegistration addHandler(WebSocketHandler webSocketHandler, String... paths) { public WebSocketHandlerRegistration addHandler(WebSocketHandler webSocketHandler, String... paths) {
ServletWebSocketHandlerRegistration r = new ServletWebSocketHandlerRegistration(this.sockJsTaskScheduler); ServletWebSocketHandlerRegistration registration =
r.addHandler(webSocketHandler, paths); new ServletWebSocketHandlerRegistration(this.sockJsTaskScheduler);
this.registrations.add(r); registration.addHandler(webSocketHandler, paths);
return r; this.registrations.add(registration);
return registration;
} }
/** /**
* Returns a {@link HandlerMapping} with mapped {@link HttpRequestHandler}s. * Return a {@link HandlerMapping} with mapped {@link HttpRequestHandler}s.
*/ */
AbstractHandlerMapping getHandlerMapping() { public AbstractHandlerMapping getHandlerMapping() {
Map<String, Object> urlMap = new LinkedHashMap<String, Object>(); Map<String, Object> urlMap = new LinkedHashMap<String, Object>();
for (ServletWebSocketHandlerRegistration registration : this.registrations) { for (ServletWebSocketHandlerRegistration registration : this.registrations) {
MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings(); MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();

4
spring-websocket/src/main/java/org/springframework/web/socket/config/SockJsServiceRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/SockJsServiceRegistration.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.config; package org.springframework.web.socket.config.annotation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -29,7 +29,7 @@ import org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsServ
/** /**
* A helper class for configuring SockJS fallback options, typically used indirectly, in * A helper class for configuring SockJS fallback options, typically used indirectly, in
* conjunction with {@link EnableWebSocket @EnableWebSocket} and * conjunction with {@link org.springframework.web.socket.config.annotation.EnableWebSocket @EnableWebSocket} and
* {@link WebSocketConfigurer}. * {@link WebSocketConfigurer}.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev

2
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/StompEndpointRegistry.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/StompEndpointRegistry.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config.annotation;
/** /**
* A contract for registering STOMP over WebSocket endpoints. * A contract for registering STOMP over WebSocket endpoints.

3
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/StompWebSocketEndpointRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/StompWebSocketEndpointRegistration.java

@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config.annotation;
import org.springframework.web.socket.server.HandshakeHandler; import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.config.SockJsServiceRegistration;
/** /**
* A contract for configuring a STOMP over WebSocket endpoint. * A contract for configuring a STOMP over WebSocket endpoint.

13
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/WebMvcStompEndpointRegistry.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistry.java

@ -14,12 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config.annotation;
import java.util.*; import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.messaging.simp.handler.UserSessionRegistry; import org.springframework.messaging.simp.handler.UserSessionRegistry;
import org.springframework.web.socket.messaging.StompSubProtocolHandler;
import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.TaskScheduler;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
@ -27,6 +29,7 @@ import org.springframework.web.HttpRequestHandler;
import org.springframework.web.servlet.handler.AbstractHandlerMapping; import org.springframework.web.servlet.handler.AbstractHandlerMapping;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.messaging.StompSubProtocolHandler;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler; import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
import org.springframework.web.socket.support.WebSocketHandlerDecorator; import org.springframework.web.socket.support.WebSocketHandlerDecorator;
@ -98,9 +101,9 @@ public class WebMvcStompEndpointRegistry implements StompEndpointRegistry {
} }
/** /**
* Returns a handler mapping with the mapped ViewControllers; or {@code null} in case of no registrations. * Return a handler mapping with the mapped ViewControllers; or {@code null} in case of no registrations.
*/ */
protected AbstractHandlerMapping getHandlerMapping() { public AbstractHandlerMapping getHandlerMapping() {
Map<String, Object> urlMap = new LinkedHashMap<String, Object>(); Map<String, Object> urlMap = new LinkedHashMap<String, Object>();
for (WebMvcStompWebSocketEndpointRegistration registration : this.registrations) { for (WebMvcStompWebSocketEndpointRegistration registration : this.registrations) {
MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings(); MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();

5
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/WebMvcStompWebSocketEndpointRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebMvcStompWebSocketEndpointRegistration.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config.annotation;
import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.TaskScheduler;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -23,7 +23,6 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.HttpRequestHandler; import org.springframework.web.HttpRequestHandler;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.HandshakeHandler; import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.config.SockJsServiceRegistration;
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler; import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler; import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsService; import org.springframework.web.socket.sockjs.SockJsService;
@ -82,7 +81,7 @@ public class WebMvcStompWebSocketEndpointRegistration implements StompWebSocketE
return this.registration; return this.registration;
} }
protected final MultiValueMap<HttpRequestHandler, String> getMappings() { public final MultiValueMap<HttpRequestHandler, String> getMappings() {
MultiValueMap<HttpRequestHandler, String> mappings = new LinkedMultiValueMap<HttpRequestHandler, String>(); MultiValueMap<HttpRequestHandler, String> mappings = new LinkedMultiValueMap<HttpRequestHandler, String>();
if (this.registration != null) { if (this.registration != null) {
SockJsService sockJsService = this.registration.getSockJsService(); SockJsService sockJsService = this.registration.getSockJsService();

2
spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketConfigurationSupport.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketConfigurationSupport.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.config; package org.springframework.web.socket.config.annotation;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

4
spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketConfigurer.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketConfigurer.java

@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.config; package org.springframework.web.socket.config.annotation;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
/** /**
* Defines callback methods to configure the WebSocket request handling * Defines callback methods to configure the WebSocket request handling
* via {@link EnableWebSocket @EnableWebSocket}. * via {@link org.springframework.web.socket.config.annotation.EnableWebSocket @EnableWebSocket}.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 4.0 * @since 4.0

2
spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketHandlerRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketHandlerRegistration.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.config; package org.springframework.web.socket.config.annotation;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.HandshakeHandler; import org.springframework.web.socket.server.HandshakeHandler;

2
spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketHandlerRegistry.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketHandlerRegistry.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.config; package org.springframework.web.socket.config.annotation;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;

6
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/WebSocketMessageBrokerConfigurationSupport.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketMessageBrokerConfigurationSupport.java

@ -14,14 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config.annotation;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.messaging.simp.config.AbstractMessageBrokerConfiguration; import org.springframework.messaging.simp.config.AbstractMessageBrokerConfiguration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.SockJsServiceRegistration;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler; import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
/** /**
@ -37,16 +36,13 @@ import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
*/ */
public abstract class WebSocketMessageBrokerConfigurationSupport extends AbstractMessageBrokerConfiguration { public abstract class WebSocketMessageBrokerConfigurationSupport extends AbstractMessageBrokerConfiguration {
protected WebSocketMessageBrokerConfigurationSupport() { protected WebSocketMessageBrokerConfigurationSupport() {
} }
@Bean @Bean
public HandlerMapping stompWebSocketHandlerMapping() { public HandlerMapping stompWebSocketHandlerMapping() {
WebMvcStompEndpointRegistry registry = new WebMvcStompEndpointRegistry( WebMvcStompEndpointRegistry registry = new WebMvcStompEndpointRegistry(
subProtocolWebSocketHandler(), userSessionRegistry(), messageBrokerSockJsTaskScheduler()); subProtocolWebSocketHandler(), userSessionRegistry(), messageBrokerSockJsTaskScheduler());
registerStompEndpoints(registry); registerStompEndpoints(registry);
return registry.getHandlerMapping(); return registry.getHandlerMapping();
} }

4
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/WebSocketMessageBrokerConfigurer.java → spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketMessageBrokerConfigurer.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config.annotation;
import org.springframework.messaging.simp.config.ChannelRegistration; import org.springframework.messaging.simp.config.ChannelRegistration;
@ -24,7 +24,7 @@ import org.springframework.messaging.simp.config.MessageBrokerRegistry;
* Defines methods for configuring message handling with simple messaging * Defines methods for configuring message handling with simple messaging
* protocols (e.g. STOMP) from WebSocket clients. Typically used to customize * protocols (e.g. STOMP) from WebSocket clients. Typically used to customize
* the configuration provided via * the configuration provided via
* {@link EnableWebSocketMessageBroker @EnableWebSocketMessageBroker}. * {@link org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker @EnableWebSocketMessageBroker}.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 4.0 * @since 4.0

21
spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/package-info.java

@ -0,0 +1,21 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Support for annotation-based WebSocket setup in configuration classes.
*/
package org.springframework.web.socket.config.annotation;

21
spring-websocket/src/main/java/org/springframework/web/socket/messaging/package-info.java

@ -0,0 +1,21 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* WebSocket integration for Spring's messaging module.
*/
package org.springframework.web.socket.messaging;

6
spring-websocket/src/test/java/org/springframework/web/socket/WebSocketIntegrationTests.java

@ -31,9 +31,9 @@ import org.springframework.web.socket.adapter.WebSocketHandlerAdapter;
import org.springframework.web.socket.client.endpoint.StandardWebSocketClient; import org.springframework.web.socket.client.endpoint.StandardWebSocketClient;
import org.springframework.web.socket.client.jetty.JettyWebSocketClient; import org.springframework.web.socket.client.jetty.JettyWebSocketClient;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.config.EnableWebSocket; import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.WebSocketHandlerRegistry; import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.support.WebSocketHttpHeaders; import org.springframework.web.socket.support.WebSocketHttpHeaders;
import static org.junit.Assert.*; import static org.junit.Assert.*;

3
spring-websocket/src/test/java/org/springframework/web/socket/config/AbstractWebSocketHandlerRegistrationTests.java

@ -26,6 +26,7 @@ import org.mockito.Mockito;
import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.TaskScheduler;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.adapter.TextWebSocketHandlerAdapter; import org.springframework.web.socket.adapter.TextWebSocketHandlerAdapter;
import org.springframework.web.socket.config.annotation.AbstractWebSocketHandlerRegistration;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.HandshakeHandler; import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.HandshakeInterceptor; import org.springframework.web.socket.server.HandshakeInterceptor;
@ -38,7 +39,7 @@ import org.springframework.web.socket.sockjs.transport.handler.WebSocketTranspor
import static org.junit.Assert.*; import static org.junit.Assert.*;
/** /**
* Test fixture for {@link AbstractWebSocketHandlerRegistration}. * Test fixture for {@link org.springframework.web.socket.config.annotation.AbstractWebSocketHandlerRegistration}.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
*/ */

6
spring-websocket/src/test/java/org/springframework/web/socket/messaging/config/WebMvcStompEndpointRegistrationTests.java → spring-websocket/src/test/java/org/springframework/web/socket/config/WebMvcStompEndpointRegistrationTests.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -23,10 +23,12 @@ import java.util.Map;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.springframework.messaging.support.channel.ExecutorSubscribableChannel; import org.springframework.messaging.support.channel.ExecutorSubscribableChannel;
import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.TaskScheduler;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.HttpRequestHandler; import org.springframework.web.HttpRequestHandler;
import org.springframework.web.socket.config.annotation.WebMvcStompWebSocketEndpointRegistration;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler; import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler; import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler; import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
@ -38,7 +40,7 @@ import org.springframework.web.socket.sockjs.transport.handler.WebSocketTranspor
import static org.junit.Assert.*; import static org.junit.Assert.*;
/** /**
* Test fixture for {@link WebMvcStompWebSocketEndpointRegistration}. * Test fixture for {@link org.springframework.web.socket.config.annotation.WebMvcStompWebSocketEndpointRegistration}.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
*/ */

7
spring-websocket/src/test/java/org/springframework/web/socket/messaging/config/WebMvcStompEndpointRegistryTests.java → spring-websocket/src/test/java/org/springframework/web/socket/config/WebMvcStompEndpointRegistryTests.java

@ -14,28 +14,29 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config;
import java.util.Map; import java.util.Map;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel; import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry; import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry;
import org.springframework.messaging.simp.handler.UserSessionRegistry; import org.springframework.messaging.simp.handler.UserSessionRegistry;
import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.TaskScheduler;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.socket.config.annotation.WebMvcStompEndpointRegistry;
import org.springframework.web.socket.messaging.StompSubProtocolHandler; import org.springframework.web.socket.messaging.StompSubProtocolHandler;
import org.springframework.web.socket.messaging.SubProtocolHandler; import org.springframework.web.socket.messaging.SubProtocolHandler;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler; import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
/** /**
* Test fixture for {@link WebMvcStompEndpointRegistry}. * Test fixture for {@link org.springframework.web.socket.config.annotation.WebMvcStompEndpointRegistry}.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
*/ */

3
spring-websocket/src/test/java/org/springframework/web/socket/config/WebSocketConfigurationTests.java

@ -34,6 +34,9 @@ import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.adapter.WebSocketHandlerAdapter; import org.springframework.web.socket.adapter.WebSocketHandlerAdapter;
import org.springframework.web.socket.client.endpoint.StandardWebSocketClient; import org.springframework.web.socket.client.endpoint.StandardWebSocketClient;
import org.springframework.web.socket.client.jetty.JettyWebSocketClient; import org.springframework.web.socket.client.jetty.JettyWebSocketClient;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.HandshakeHandler; import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler; import org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler;

18
spring-websocket/src/test/java/org/springframework/web/socket/messaging/config/WebSocketMessageBrokerConfigurationSupportTests.java → spring-websocket/src/test/java/org/springframework/web/socket/config/WebSocketMessageBrokerConfigurationSupportTests.java

@ -14,10 +14,15 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -31,24 +36,23 @@ import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry; import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.messaging.simp.stomp.StompCommand; import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaderAccessor; import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
import org.springframework.web.socket.messaging.StompTextMessageBuilder;
import org.springframework.messaging.support.channel.AbstractSubscribableChannel; import org.springframework.messaging.support.channel.AbstractSubscribableChannel;
import org.springframework.messaging.support.channel.ExecutorSubscribableChannel; import org.springframework.messaging.support.channel.ExecutorSubscribableChannel;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.messaging.StompTextMessageBuilder;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler; import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
import org.springframework.web.socket.support.TestWebSocketSession; import org.springframework.web.socket.support.TestWebSocketSession;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*; import static org.junit.Assert.*;
/** /**
* Test fixture for {@link WebSocketMessageBrokerConfigurationSupport}. * Test fixture for {@link org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport}.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
*/ */

6
spring-websocket/src/test/java/org/springframework/web/socket/messaging/SimpAnnotationMethodIntegrationTests.java

@ -50,9 +50,9 @@ import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.adapter.TextWebSocketHandlerAdapter; import org.springframework.web.socket.adapter.TextWebSocketHandlerAdapter;
import org.springframework.web.socket.client.endpoint.StandardWebSocketClient; import org.springframework.web.socket.client.endpoint.StandardWebSocketClient;
import org.springframework.web.socket.client.jetty.JettyWebSocketClient; import org.springframework.web.socket.client.jetty.JettyWebSocketClient;
import org.springframework.web.socket.messaging.config.DelegatingWebSocketMessageBrokerConfiguration; import org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration;
import org.springframework.web.socket.messaging.config.StompEndpointRegistry; import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.messaging.config.WebSocketMessageBrokerConfigurer; import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.server.HandshakeHandler; import org.springframework.web.socket.server.HandshakeHandler;
import static org.junit.Assert.*; import static org.junit.Assert.*;

Loading…
Cancel
Save