Browse Source

Rearranged web.socket.server subpackages and introduced web.socket.config

pull/423/head
Juergen Hoeller 11 years ago committed by unknown
parent
commit
e3e1c1bcec
  1. 4
      spring-websocket/src/main/java/org/springframework/web/socket/config/AbstractWebSocketHandlerRegistration.java
  2. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/DelegatingWebSocketConfiguration.java
  3. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/EnableWebSocket.java
  4. 15
      spring-websocket/src/main/java/org/springframework/web/socket/config/HandlersBeanDefinitionParser.java
  5. 14
      spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java
  6. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/ServletWebSocketHandlerRegistration.java
  7. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/ServletWebSocketHandlerRegistry.java
  8. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/SockJsServiceRegistration.java
  9. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketConfigurationSupport.java
  10. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketConfigurer.java
  11. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketHandlerRegistration.java
  12. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketHandlerRegistry.java
  13. 5
      spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketNamespaceHandler.java
  14. 45
      spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketNamespaceUtils.java
  15. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/package-info.java
  16. 2
      spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/StompWebSocketEndpointRegistration.java
  17. 2
      spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/WebMvcStompWebSocketEndpointRegistration.java
  18. 2
      spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/WebSocketMessageBrokerConfigurationSupport.java
  19. 20
      spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/xml/package-info.java
  20. 20
      spring-websocket/src/main/java/org/springframework/web/socket/server/config/xml/package-info.java
  21. 22
      spring-websocket/src/main/java/org/springframework/web/socket/server/endpoint/package-info.java
  22. 2
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/AbstractGlassFishRequestUpgradeStrategy.java
  23. 12
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/DefaultHandshakeHandler.java
  24. 2
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/ServerEndpointExporter.java
  25. 2
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/ServerEndpointRegistration.java
  26. 47
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/ServletServerContainerFactoryBean.java
  27. 2
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/SpringConfigurator.java
  28. 2
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/TomcatRequestUpgradeStrategy.java
  29. 2
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/WebSocketHttpRequestHandler.java
  30. 2
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/DefaultSockJsService.java
  31. 18
      spring-websocket/src/main/resources/META-INF/spring.handlers
  32. 20
      spring-websocket/src/main/resources/META-INF/spring.schemas
  33. 0
      spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket-4.0.xsd
  34. 2
      spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java
  35. 8
      spring-websocket/src/test/java/org/springframework/web/socket/WebSocketIntegrationTests.java
  36. 4
      spring-websocket/src/test/java/org/springframework/web/socket/config/AbstractWebSocketHandlerRegistrationTests.java
  37. 4
      spring-websocket/src/test/java/org/springframework/web/socket/config/HandlersBeanDefinitionParserTests.java
  38. 7
      spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java
  39. 2
      spring-websocket/src/test/java/org/springframework/web/socket/config/WebSocketConfigurationTests.java
  40. 2
      spring-websocket/src/test/java/org/springframework/web/socket/messaging/config/WebMvcStompEndpointRegistrationTests.java
  41. 3
      spring-websocket/src/test/java/org/springframework/web/socket/server/DefaultHandshakeHandlerTests.java
  42. 4
      spring-websocket/src/test/java/org/springframework/web/socket/server/endpoint/ServerEndpointExporterTests.java
  43. 3
      spring-websocket/src/test/java/org/springframework/web/socket/server/endpoint/ServerEndpointRegistrationTests.java
  44. 1
      spring-websocket/src/test/java/org/springframework/web/socket/server/endpoint/SpringConfiguratorTests.java
  45. 36
      spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-broker-customchannels.xml
  46. 23
      spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-broker-relay.xml
  47. 20
      spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-broker-simple.xml
  48. 24
      spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-handlers-attributes.xml
  49. 26
      spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-handlers-sockjs-attributes.xml
  50. 17
      spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-handlers-sockjs.xml
  51. 19
      spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-handlers.xml
  52. 35
      spring-websocket/src/test/resources/org/springframework/web/socket/messaging/config/xml/websocket-config-broker-simple.xml
  53. 40
      spring-websocket/src/test/resources/org/springframework/web/socket/server/config/xml/websocket-config-handlers-attributes.xml
  54. 33
      spring-websocket/src/test/resources/org/springframework/web/socket/server/config/xml/websocket-config-handlers-sockjs.xml
  55. 35
      spring-websocket/src/test/resources/org/springframework/web/socket/server/config/xml/websocket-config-handlers.xml

4
spring-websocket/src/main/java/org/springframework/web/socket/server/config/AbstractWebSocketHandlerRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/AbstractWebSocketHandlerRegistration.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config;
package org.springframework.web.socket.config;
import java.util.Arrays;
@ -23,7 +23,7 @@ import org.springframework.util.Assert; @@ -23,7 +23,7 @@ import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;
import org.springframework.web.socket.sockjs.SockJsService;

2
spring-websocket/src/main/java/org/springframework/web/socket/server/config/DelegatingWebSocketConfiguration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/DelegatingWebSocketConfiguration.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config;
package org.springframework.web.socket.config;
import java.util.ArrayList;
import java.util.List;

2
spring-websocket/src/main/java/org/springframework/web/socket/server/config/EnableWebSocket.java → spring-websocket/src/main/java/org/springframework/web/socket/config/EnableWebSocket.java

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
* 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.
*/
package org.springframework.web.socket.server.config;
package org.springframework.web.socket.config;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;

15
spring-websocket/src/main/java/org/springframework/web/socket/server/config/xml/HandlersBeanDefinitionParser.java → spring-websocket/src/main/java/org/springframework/web/socket/config/HandlersBeanDefinitionParser.java

@ -14,7 +14,12 @@ @@ -14,7 +14,12 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config.xml;
package org.springframework.web.socket.config;
import java.util.Arrays;
import java.util.List;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
@ -28,13 +33,9 @@ import org.springframework.beans.factory.xml.BeanDefinitionParser; @@ -28,13 +33,9 @@ import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.util.xml.DomUtils;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.socket.config.WebSocketNamespaceUtils;
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
import org.w3c.dom.Element;
import java.util.Arrays;
import java.util.List;
/**
* A {@link BeanDefinitionParser} that provides the configuration for the
@ -46,7 +47,7 @@ import java.util.List; @@ -46,7 +47,7 @@ import java.util.List;
* @author Brian Clozel
* @since 4.0
*/
public class HandlersBeanDefinitionParser implements BeanDefinitionParser {
class HandlersBeanDefinitionParser implements BeanDefinitionParser {
private static final String SOCK_JS_SCHEDULER_NAME = "SockJsScheduler";

14
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/xml/MessageBrokerBeanDefinitionParser.java → spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java

@ -14,7 +14,12 @@ @@ -14,7 +14,12 @@
* limitations under the License.
*/
package org.springframework.web.socket.messaging.config.xml;
package org.springframework.web.socket.config;
import java.util.Arrays;
import java.util.List;
import org.w3c.dom.Element;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.BeanDefinition;
@ -49,13 +54,8 @@ import org.springframework.util.xml.DomUtils; @@ -49,13 +54,8 @@ import org.springframework.util.xml.DomUtils;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.socket.messaging.StompSubProtocolHandler;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
import org.springframework.web.socket.server.config.xml.WebSocketNamespaceUtils;
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
import org.w3c.dom.Element;
import java.util.Arrays;
import java.util.List;
/**
@ -85,7 +85,7 @@ import java.util.List; @@ -85,7 +85,7 @@ import java.util.List;
* @author Rossen Stoyanchev
* @since 4.0
*/
public class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
protected static final String SOCKJS_SCHEDULER_BEAN_NAME = "messageBrokerSockJsScheduler";

2
spring-websocket/src/main/java/org/springframework/web/socket/server/config/ServletWebSocketHandlerRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/ServletWebSocketHandlerRegistration.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config;
package org.springframework.web.socket.config;
import java.util.Arrays;

2
spring-websocket/src/main/java/org/springframework/web/socket/server/config/ServletWebSocketHandlerRegistry.java → spring-websocket/src/main/java/org/springframework/web/socket/config/ServletWebSocketHandlerRegistry.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config;
package org.springframework.web.socket.config;
import java.util.ArrayList;
import java.util.LinkedHashMap;

2
spring-websocket/src/main/java/org/springframework/web/socket/server/config/SockJsServiceRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/config/SockJsServiceRegistration.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config;
package org.springframework.web.socket.config;
import java.util.ArrayList;
import java.util.Arrays;

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

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

2
spring-websocket/src/main/java/org/springframework/web/socket/server/config/WebSocketConfigurer.java → spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketConfigurer.java

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

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

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

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

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

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

@ -14,12 +14,10 @@ @@ -14,12 +14,10 @@
* limitations under the License.
*/
package org.springframework.web.socket.messaging.config.xml;
package org.springframework.web.socket.config;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
import org.springframework.util.ClassUtils;
import org.springframework.web.socket.server.config.xml.HandlersBeanDefinitionParser;
/**
* {@link org.springframework.beans.factory.xml.NamespaceHandler} for Spring WebSocket
@ -41,4 +39,5 @@ public class WebSocketNamespaceHandler extends NamespaceHandlerSupport { @@ -41,4 +39,5 @@ public class WebSocketNamespaceHandler extends NamespaceHandlerSupport {
registerBeanDefinitionParser("message-broker", new MessageBrokerBeanDefinitionParser());
}
}
}

45
spring-websocket/src/main/java/org/springframework/web/socket/server/config/xml/WebSocketNamespaceUtils.java → spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketNamespaceUtils.java

@ -14,7 +14,11 @@ @@ -14,7 +14,11 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config.xml;
package org.springframework.web.socket.config;
import java.util.Collections;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
@ -25,11 +29,8 @@ import org.springframework.beans.factory.support.RootBeanDefinition; @@ -25,11 +29,8 @@ import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.util.xml.DomUtils;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService;
import org.w3c.dom.Element;
import java.util.Collections;
/**
* Provides utility methods for parsing common WebSocket XML namespace elements.
@ -38,15 +39,12 @@ import java.util.Collections; @@ -38,15 +39,12 @@ import java.util.Collections;
* @author Rossen Stoyanchev
* @since 4.0
*/
public class WebSocketNamespaceUtils {
class WebSocketNamespaceUtils {
public static RuntimeBeanReference registerHandshakeHandler(Element element, ParserContext parserContext, Object source) {
RuntimeBeanReference handlerRef;
Element handlerElem = DomUtils.getChildElementByTagName(element, "handshake-handler");
if(handlerElem != null) {
if (handlerElem != null) {
handlerRef = new RuntimeBeanReference(handlerElem.getAttribute("ref"));
}
else {
@ -56,7 +54,6 @@ public class WebSocketNamespaceUtils { @@ -56,7 +54,6 @@ public class WebSocketNamespaceUtils {
String handlerName = parserContext.getReaderContext().registerWithGeneratedName(defaultHandlerDef);
handlerRef = new RuntimeBeanReference(handlerName);
}
return handlerRef;
}
@ -65,13 +62,13 @@ public class WebSocketNamespaceUtils { @@ -65,13 +62,13 @@ public class WebSocketNamespaceUtils {
Element sockJsElement = DomUtils.getChildElementByTagName(element, "sockjs");
if(sockJsElement != null) {
if (sockJsElement != null) {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
// TODO: polish the way constructor arguments are set
String customTaskSchedulerName = sockJsElement.getAttribute("task-scheduler");
if(!customTaskSchedulerName.isEmpty()) {
if (!customTaskSchedulerName.isEmpty()) {
cavs.addIndexedArgumentValue(0, new RuntimeBeanReference(customTaskSchedulerName));
}
else {
@ -80,16 +77,16 @@ public class WebSocketNamespaceUtils { @@ -80,16 +77,16 @@ public class WebSocketNamespaceUtils {
Element transportHandlersElement = DomUtils.getChildElementByTagName(sockJsElement, "transport-handlers");
boolean registerDefaults = true;
if(transportHandlersElement != null) {
if (transportHandlersElement != null) {
String registerDefaultsAttribute = transportHandlersElement.getAttribute("register-defaults");
registerDefaults = !registerDefaultsAttribute.equals("false");
}
ManagedList<?> transportHandlersList = parseBeanSubElements(transportHandlersElement, parserContext);
if(registerDefaults) {
if (registerDefaults) {
cavs.addIndexedArgumentValue(1, Collections.emptyList());
if(transportHandlersList.isEmpty()) {
if (transportHandlersList.isEmpty()) {
cavs.addIndexedArgumentValue(2, new ConstructorArgumentValues.ValueHolder(null));
}
else {
@ -97,7 +94,7 @@ public class WebSocketNamespaceUtils { @@ -97,7 +94,7 @@ public class WebSocketNamespaceUtils {
}
}
else {
if(transportHandlersList.isEmpty()) {
if (transportHandlersList.isEmpty()) {
cavs.addIndexedArgumentValue(1, new ConstructorArgumentValues.ValueHolder(null));
}
else {
@ -110,31 +107,31 @@ public class WebSocketNamespaceUtils { @@ -110,31 +107,31 @@ public class WebSocketNamespaceUtils {
sockJsServiceDef.setSource(source);
String attrValue = sockJsElement.getAttribute("name");
if(!attrValue.isEmpty()) {
if (!attrValue.isEmpty()) {
sockJsServiceDef.getPropertyValues().add("name", attrValue);
}
attrValue = sockJsElement.getAttribute("websocket-enabled");
if(!attrValue.isEmpty()) {
if (!attrValue.isEmpty()) {
sockJsServiceDef.getPropertyValues().add("webSocketsEnabled", Boolean.valueOf(attrValue));
}
attrValue = sockJsElement.getAttribute("session-cookie-needed");
if(!attrValue.isEmpty()) {
if (!attrValue.isEmpty()) {
sockJsServiceDef.getPropertyValues().add("sessionCookieNeeded", Boolean.valueOf(attrValue));
}
attrValue = sockJsElement.getAttribute("stream-bytes-limit");
if(!attrValue.isEmpty()) {
if (!attrValue.isEmpty()) {
sockJsServiceDef.getPropertyValues().add("streamBytesLimit", Integer.valueOf(attrValue));
}
attrValue = sockJsElement.getAttribute("disconnect-delay");
if(!attrValue.isEmpty()) {
if (!attrValue.isEmpty()) {
sockJsServiceDef.getPropertyValues().add("disconnectDelay", Long.valueOf(attrValue));
}
attrValue = sockJsElement.getAttribute("http-message-cache-size");
if(!attrValue.isEmpty()) {
if (!attrValue.isEmpty()) {
sockJsServiceDef.getPropertyValues().add("httpMessageCacheSize", Integer.valueOf(attrValue));
}
attrValue = sockJsElement.getAttribute("heartbeat-time");
if(!attrValue.isEmpty()) {
if (!attrValue.isEmpty()) {
sockJsServiceDef.getPropertyValues().add("heartbeatTime", Long.valueOf(attrValue));
}

2
spring-websocket/src/main/java/org/springframework/web/socket/server/config/package-info.java → spring-websocket/src/main/java/org/springframework/web/socket/config/package-info.java

@ -17,5 +17,5 @@ @@ -17,5 +17,5 @@
/**
* Configuration support for WebSocket request handling.
*/
package org.springframework.web.socket.server.config;
package org.springframework.web.socket.config;

2
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/StompWebSocketEndpointRegistration.java

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
package org.springframework.web.socket.messaging.config;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.config.SockJsServiceRegistration;
import org.springframework.web.socket.config.SockJsServiceRegistration;
/**
* A contract for configuring a STOMP over WebSocket endpoint.

2
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/WebMvcStompWebSocketEndpointRegistration.java

@ -23,7 +23,7 @@ import org.springframework.util.MultiValueMap; @@ -23,7 +23,7 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.config.SockJsServiceRegistration;
import org.springframework.web.socket.config.SockJsServiceRegistration;
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsService;

2
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/WebSocketMessageBrokerConfigurationSupport.java

@ -21,7 +21,7 @@ import org.springframework.messaging.simp.config.AbstractMessageBrokerConfigurat @@ -21,7 +21,7 @@ import org.springframework.messaging.simp.config.AbstractMessageBrokerConfigurat
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.config.SockJsServiceRegistration;
import org.springframework.web.socket.config.SockJsServiceRegistration;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
/**

20
spring-websocket/src/main/java/org/springframework/web/socket/messaging/config/xml/package-info.java

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
/*
* 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 the {@code <websocket:message-broker>} XML namespace element.
*/
package org.springframework.web.socket.messaging.config.xml;

20
spring-websocket/src/main/java/org/springframework/web/socket/server/config/xml/package-info.java

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
/*
* 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 the {@code <websocket:handlers>} XML namespace element.
*/
package org.springframework.web.socket.server.config.xml;

22
spring-websocket/src/main/java/org/springframework/web/socket/server/endpoint/package-info.java

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
/*
* 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.
*/
/**
* Server classes for use with standard Java WebSocket endpoints providing configuration
* and initialization support.
*/
package org.springframework.web.socket.server.endpoint;

2
spring-websocket/src/main/java/org/springframework/web/socket/server/support/AbstractGlassFishRequestUpgradeStrategy.java

@ -50,8 +50,6 @@ import org.springframework.util.ClassUtils; @@ -50,8 +50,6 @@ import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.socket.server.HandshakeFailureException;
import org.springframework.web.socket.server.endpoint.ServerEndpointRegistration;
import org.springframework.web.socket.server.endpoint.ServletServerContainerFactoryBean;
/**
* GlassFish support for upgrading a request during a WebSocket handshake. To modify

12
spring-websocket/src/main/java/org/springframework/web/socket/server/DefaultHandshakeHandler.java → spring-websocket/src/main/java/org/springframework/web/socket/server/support/DefaultHandshakeHandler.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server;
package org.springframework.web.socket.server.support;
import java.io.IOException;
import java.util.ArrayList;
@ -25,6 +25,7 @@ import java.util.Map; @@ -25,6 +25,7 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
@ -32,21 +33,24 @@ import org.springframework.http.server.ServerHttpRequest; @@ -32,21 +33,24 @@ import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.HandshakeFailureException;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.RequestUpgradeStrategy;
import org.springframework.web.socket.support.SubProtocolCapable;
import org.springframework.web.socket.support.WebSocketExtension;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.support.WebSocketHandlerDecorator;
import org.springframework.web.socket.support.WebSocketHttpHeaders;
/**
* A default {@link HandshakeHandler} implementation. Performs initial validation of the
* A default {@link org.springframework.web.socket.server.HandshakeHandler} implementation. Performs initial validation of the
* WebSocket handshake request -- possibly rejecting it through the appropriate HTTP
* status code -- while also allowing sub-classes to override various parts of the
* negotiation process (e.g. origin validation, sub-protocol negotiation,
* extensions negotiation, etc).
*
* <p>If the negotiation succeeds, the actual upgrade is delegated to a server-specific
* {@link RequestUpgradeStrategy}, which will update the response as necessary and
* {@link org.springframework.web.socket.server.RequestUpgradeStrategy}, which will update the response as necessary and
* initialize the WebSocket. Currently supported servers are Tomcat 7 and 8, Jetty 9, and
* Glassfish 4.
*

2
spring-websocket/src/main/java/org/springframework/web/socket/server/endpoint/ServerEndpointExporter.java → spring-websocket/src/main/java/org/springframework/web/socket/server/support/ServerEndpointExporter.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.endpoint;
package org.springframework.web.socket.server.support;
import java.lang.reflect.Method;
import java.util.ArrayList;

2
spring-websocket/src/main/java/org/springframework/web/socket/server/endpoint/ServerEndpointRegistration.java → spring-websocket/src/main/java/org/springframework/web/socket/server/support/ServerEndpointRegistration.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.endpoint;
package org.springframework.web.socket.server.support;
import java.util.ArrayList;
import java.util.HashMap;

47
spring-websocket/src/main/java/org/springframework/web/socket/server/endpoint/ServletServerContainerFactoryBean.java → spring-websocket/src/main/java/org/springframework/web/socket/server/support/ServletServerContainerFactoryBean.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.endpoint;
package org.springframework.web.socket.server.support;
import javax.servlet.ServletContext;
import javax.websocket.WebSocketContainer;
@ -24,8 +24,6 @@ import org.springframework.beans.factory.FactoryBean; @@ -24,8 +24,6 @@ import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import org.springframework.web.context.ServletContextAware;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.sockjs.SockJsService;
/**
* A FactoryBean for configuring {@link javax.websocket.server.ServerContainer}. Since
@ -36,9 +34,9 @@ import org.springframework.web.socket.sockjs.SockJsService; @@ -36,9 +34,9 @@ import org.springframework.web.socket.sockjs.SockJsService;
*
* <p>This is useful even if the {@code ServerContainer} is not injected into any other
* bean. For example, an application can configure a {@link DefaultHandshakeHandler}, a
* {@link SockJsService}, or {@link ServerEndpointExporter}, and separately declare this
* FactoryBean in order to customize the properties of the (one and only)
* {@code ServerContainer} instance.
* {@link org.springframework.web.socket.sockjs.SockJsService}, or {@link ServerEndpointExporter},
* and separately declare this FactoryBean in order to customize the properties of the
* (one and only) {@code ServerContainer} instance.
*
* @author Rossen Stoyanchev
* @since 4.0
@ -94,26 +92,11 @@ public class ServletServerContainerFactoryBean @@ -94,26 +92,11 @@ public class ServletServerContainerFactoryBean
this.serverContainer = (ServerContainer) servletContext.getAttribute("javax.websocket.server.ServerContainer");
}
@Override
public ServerContainer getObject() {
return this.serverContainer;
}
@Override
public Class<?> getObjectType() {
return ServerContainer.class;
}
@Override
public boolean isSingleton() {
return false;
}
@Override
public void afterPropertiesSet() throws Exception {
Assert.state(this.serverContainer != null, "A ServletContext is required to "
+ "access the javax.websocket.server.ServerContainer instance");
public void afterPropertiesSet() {
Assert.state(this.serverContainer != null,
"A ServletContext is required to access the javax.websocket.server.ServerContainer instance");
if (this.asyncSendTimeout != null) {
this.serverContainer.setAsyncSendTimeout(this.asyncSendTimeout);
@ -129,4 +112,20 @@ public class ServletServerContainerFactoryBean @@ -129,4 +112,20 @@ public class ServletServerContainerFactoryBean
}
}
@Override
public ServerContainer getObject() {
return this.serverContainer;
}
@Override
public Class<?> getObjectType() {
return ServerContainer.class;
}
@Override
public boolean isSingleton() {
return true;
}
}

2
spring-websocket/src/main/java/org/springframework/web/socket/server/endpoint/SpringConfigurator.java → spring-websocket/src/main/java/org/springframework/web/socket/server/support/SpringConfigurator.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.endpoint;
package org.springframework.web.socket.server.support;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

2
spring-websocket/src/main/java/org/springframework/web/socket/server/support/TomcatRequestUpgradeStrategy.java

@ -35,8 +35,6 @@ import org.springframework.http.server.ServletServerHttpRequest; @@ -35,8 +35,6 @@ import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.util.Assert;
import org.springframework.web.socket.server.HandshakeFailureException;
import org.springframework.web.socket.server.endpoint.ServerEndpointRegistration;
import org.springframework.web.socket.server.endpoint.ServletServerContainerFactoryBean;
/**
* Tomcat support for upgrading an {@link HttpServletRequest} during a WebSocket

2
spring-websocket/src/main/java/org/springframework/web/socket/server/support/WebSocketHttpRequestHandler.java

@ -21,7 +21,6 @@ import java.util.ArrayList; @@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -33,7 +32,6 @@ import org.springframework.http.server.ServletServerHttpResponse; @@ -33,7 +32,6 @@ import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.util.Assert;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.server.HandshakeFailureException;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;

2
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/DefaultSockJsService.java

@ -40,10 +40,10 @@ import org.springframework.util.CollectionUtils; @@ -40,10 +40,10 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.server.HandshakeFailureException;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.HandshakeInterceptorChain;
import org.springframework.web.socket.sockjs.SockJsException;
import org.springframework.web.socket.sockjs.SockJsService;

18
spring-websocket/src/main/resources/META-INF/spring.handlers

@ -1,17 +1 @@ @@ -1,17 +1 @@
#
# 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.
#
http\://www.springframework.org/schema/websocket=org.springframework.web.socket.messaging.config.xml.WebSocketNamespaceHandler
http\://www.springframework.org/schema/websocket=org.springframework.web.socket.config.WebSocketNamespaceHandler

20
spring-websocket/src/main/resources/META-INF/spring.schemas

@ -1,18 +1,2 @@ @@ -1,18 +1,2 @@
#
# 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.
#
http\://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd=org/springframework/web/socket/server/config/xml/spring-websocket-4.0.xsd
http\://www.springframework.org/schema/websocket/spring-websocket.xsd=org/springframework/web/socket/server/config/xml/spring-websocket-4.0.xsd
http\://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd=org/springframework/web/socket/config/spring-websocket-4.0.xsd
http\://www.springframework.org/schema/websocket/spring-websocket.xsd=org/springframework/web/socket/config/spring-websocket-4.0.xsd

0
spring-websocket/src/main/resources/org/springframework/web/socket/server/config/xml/spring-websocket-4.0.xsd → spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket-4.0.xsd

2
spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java

@ -29,7 +29,7 @@ import org.springframework.context.annotation.Configuration; @@ -29,7 +29,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.socket.client.WebSocketClient;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.RequestUpgradeStrategy;
import org.springframework.web.socket.server.support.JettyRequestUpgradeStrategy;
import org.springframework.web.socket.server.support.TomcatRequestUpgradeStrategy;

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

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

4
spring-websocket/src/test/java/org/springframework/web/socket/server/config/AbstractWebSocketHandlerRegistrationTests.java → spring-websocket/src/test/java/org/springframework/web/socket/config/AbstractWebSocketHandlerRegistrationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config;
package org.springframework.web.socket.config;
import java.util.ArrayList;
import java.util.Arrays;
@ -26,7 +26,7 @@ import org.mockito.Mockito; @@ -26,7 +26,7 @@ import org.mockito.Mockito;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.adapter.TextWebSocketHandlerAdapter;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;

4
spring-websocket/src/test/java/org/springframework/web/socket/server/config/xml/HandlersBeanDefinitionParserTests.java → spring-websocket/src/test/java/org/springframework/web/socket/config/HandlersBeanDefinitionParserTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config.xml;
package org.springframework.web.socket.config;
import org.hamcrest.Matchers;
import org.junit.Before;
@ -34,7 +34,7 @@ import org.springframework.web.socket.CloseStatus; @@ -34,7 +34,7 @@ import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.HandshakeFailureException;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;

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

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.messaging.config.xml;
package org.springframework.web.socket.config;
import org.hamcrest.Matchers;
import org.junit.Before;
@ -43,7 +43,6 @@ import org.springframework.web.socket.support.WebSocketHandlerDecorator; @@ -43,7 +43,6 @@ import org.springframework.web.socket.support.WebSocketHandlerDecorator;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
@ -64,7 +63,6 @@ public class MessageBrokerBeanDefinitionParserTests { @@ -64,7 +63,6 @@ public class MessageBrokerBeanDefinitionParserTests {
@Test
public void simpleBroker() {
loadBeanDefinitions("websocket-config-broker-simple.xml");
HandlerMapping hm = this.appContext.getBean(HandlerMapping.class);
@ -136,7 +134,6 @@ public class MessageBrokerBeanDefinitionParserTests { @@ -136,7 +134,6 @@ public class MessageBrokerBeanDefinitionParserTests {
@Test
public void stompBrokerRelay() {
loadBeanDefinitions("websocket-config-broker-relay.xml");
HandlerMapping hm = this.appContext.getBean(HandlerMapping.class);
@ -198,7 +195,6 @@ public class MessageBrokerBeanDefinitionParserTests { @@ -198,7 +195,6 @@ public class MessageBrokerBeanDefinitionParserTests {
@Test
public void annotationMethodMessageHandler() {
loadBeanDefinitions("websocket-config-broker-simple.xml");
SimpAnnotationMethodMessageHandler annotationMethodMessageHandler =
@ -221,7 +217,6 @@ public class MessageBrokerBeanDefinitionParserTests { @@ -221,7 +217,6 @@ public class MessageBrokerBeanDefinitionParserTests {
@Test
public void customChannels() {
loadBeanDefinitions("websocket-config-broker-customchannels.xml");
List<Class<? extends MessageHandler>> subscriberTypes =

2
spring-websocket/src/test/java/org/springframework/web/socket/server/config/WebSocketConfigurationTests.java → spring-websocket/src/test/java/org/springframework/web/socket/config/WebSocketConfigurationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.web.socket.server.config;
package org.springframework.web.socket.config;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;

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

@ -28,7 +28,7 @@ import org.springframework.scheduling.TaskScheduler; @@ -28,7 +28,7 @@ import org.springframework.scheduling.TaskScheduler;
import org.springframework.util.MultiValueMap;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
import org.springframework.web.socket.sockjs.transport.TransportType;

3
spring-websocket/src/test/java/org/springframework/web/socket/server/DefaultHandshakeHandlerTests.java

@ -26,6 +26,7 @@ import org.junit.Test; @@ -26,6 +26,7 @@ import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.web.socket.AbstractHttpRequestTests;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.support.SubProtocolCapable;
import org.springframework.web.socket.support.WebSocketExtension;
import org.springframework.web.socket.WebSocketHandler;
@ -36,7 +37,7 @@ import static org.junit.Assert.assertEquals; @@ -36,7 +37,7 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
/**
* Test fixture for {@link DefaultHandshakeHandler}.
* Test fixture for {@link org.springframework.web.socket.server.support.DefaultHandshakeHandler}.
*
* @author Rossen Stoyanchev
*/

4
spring-websocket/src/test/java/org/springframework/web/socket/server/endpoint/ServerEndpointExporterTests.java

@ -28,11 +28,13 @@ import org.springframework.context.annotation.Bean; @@ -28,11 +28,13 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.test.MockServletContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.socket.server.support.ServerEndpointExporter;
import org.springframework.web.socket.server.support.ServerEndpointRegistration;
import static org.mockito.Mockito.*;
/**
* Test fixture for {@link ServerEndpointExporter}.
* Test fixture for {@link org.springframework.web.socket.server.support.ServerEndpointExporter}.
*
* @author Rossen Stoyanchev
*/

3
spring-websocket/src/test/java/org/springframework/web/socket/server/endpoint/ServerEndpointRegistrationTests.java

@ -26,11 +26,12 @@ import org.springframework.context.ConfigurableApplicationContext; @@ -26,11 +26,12 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.support.ServerEndpointRegistration;
import static org.junit.Assert.*;
/**
* Test fixture for {@link ServerEndpointRegistration}.
* Test fixture for {@link org.springframework.web.socket.server.support.ServerEndpointRegistration}.
*
* @author Rossen Stoyanchev
*/

1
spring-websocket/src/test/java/org/springframework/web/socket/server/endpoint/SpringConfiguratorTests.java

@ -29,6 +29,7 @@ import org.springframework.mock.web.test.MockServletContext; @@ -29,6 +29,7 @@ import org.springframework.mock.web.test.MockServletContext;
import org.springframework.stereotype.Component;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.socket.server.support.SpringConfigurator;
import static org.junit.Assert.*;

36
spring-websocket/src/test/resources/org/springframework/web/socket/messaging/config/xml/websocket-config-broker-customchannels.xml → spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-broker-customchannels.xml

@ -1,19 +1,3 @@ @@ -1,19 +1,3 @@
<!--
~ 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
@ -22,29 +6,29 @@ @@ -22,29 +6,29 @@
<websocket:message-broker application-destination-prefix="/app" user-destination-prefix="/personal">
<websocket:stomp-endpoint path="/foo,/bar">
<websocket:handshake-handler ref="myHandler" />
<websocket:handshake-handler ref="myHandler"/>
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic" />
<websocket:simple-broker prefix="/topic"/>
<websocket:client-inbound-channel>
<websocket:executor core-pool-size="100" max-pool-size="200" keep-alive-seconds="600" />
<websocket:executor core-pool-size="100" max-pool-size="200" keep-alive-seconds="600"/>
<websocket:interceptors>
<ref bean="myInterceptor" />
<ref bean="myInterceptor"/>
</websocket:interceptors>
</websocket:client-inbound-channel>
<websocket:client-outbound-channel>
<websocket:executor core-pool-size="101" max-pool-size="201" keep-alive-seconds="601" />
<websocket:executor core-pool-size="101" max-pool-size="201" keep-alive-seconds="601"/>
<websocket:interceptors>
<ref bean="myInterceptor" />
<bean class="org.springframework.messaging.support.channel.ChannelInterceptorAdapter" />
<ref bean="myInterceptor"/>
<bean class="org.springframework.messaging.support.channel.ChannelInterceptorAdapter"/>
</websocket:interceptors>
</websocket:client-outbound-channel>
<websocket:broker-channel>
<websocket:executor core-pool-size="102" max-pool-size="202" keep-alive-seconds="602" />
<websocket:executor core-pool-size="102" max-pool-size="202" keep-alive-seconds="602"/>
</websocket:broker-channel>
</websocket:message-broker>
<bean id="myHandler" class="org.springframework.web.socket.server.config.xml.TestHandshakeHandler" />
<bean id="myHandler" class="org.springframework.web.socket.config.TestHandshakeHandler"/>
<bean id="myInterceptor" class="org.springframework.messaging.support.channel.ChannelInterceptorAdapter" />
<bean id="myInterceptor" class="org.springframework.messaging.support.channel.ChannelInterceptorAdapter"/>
</beans>

23
spring-websocket/src/test/resources/org/springframework/web/socket/messaging/config/xml/websocket-config-broker-relay.xml → spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-broker-relay.xml

@ -1,19 +1,3 @@ @@ -1,19 +1,3 @@
<!--
~ 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
@ -22,8 +6,8 @@ @@ -22,8 +6,8 @@
<websocket:message-broker order="2">
<websocket:stomp-endpoint path="/foo">
<websocket:handshake-handler ref="myHandler" />
<websocket:sockjs />
<websocket:handshake-handler ref="myHandler"/>
<websocket:sockjs/>
</websocket:stomp-endpoint>
<websocket:stomp-broker-relay
prefix="/topic,/queue"
@ -36,5 +20,6 @@ @@ -36,5 +20,6 @@
virtual-host="spring.io"/>
</websocket:message-broker>
<bean id="myHandler" class="org.springframework.web.socket.server.config.xml.TestWebSocketHandler" />
<bean id="myHandler" class="org.springframework.web.socket.config.TestWebSocketHandler"/>
</beans>

20
spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-broker-simple.xml

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:message-broker application-destination-prefix="/app" user-destination-prefix="/personal">
<websocket:stomp-endpoint path=" /foo,/bar">
<websocket:handshake-handler ref="myHandler"/>
</websocket:stomp-endpoint>
<websocket:stomp-endpoint path="/test,/sockjs">
<websocket:handshake-handler ref="myHandler"/>
<websocket:sockjs/>
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic"/>
</websocket:message-broker>
<bean id="myHandler" class="org.springframework.web.socket.config.TestHandshakeHandler"/>
</beans>

24
spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-handlers-attributes.xml

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:handlers order="2">
<websocket:mapping path="/foo" handler="fooHandler"/>
<websocket:mapping path="/test" handler="testHandler"/>
<websocket:handshake-handler ref="testHandshakeHandler"/>
<websocket:handshake-interceptors>
<bean class="org.springframework.web.socket.config.FooTestInterceptor"/>
<ref bean="barTestInterceptor"/>
</websocket:handshake-interceptors>
</websocket:handlers>
<bean id="testHandler" class="org.springframework.web.socket.config.TestWebSocketHandler"/>
<bean id="fooHandler" class="org.springframework.web.socket.config.FooWebSocketHandler"/>
<bean id="barTestInterceptor" class="org.springframework.web.socket.config.BarTestInterceptor"/>
<bean id="testHandshakeHandler" class="org.springframework.web.socket.config.TestHandshakeHandler"/>
</beans>

26
spring-websocket/src/test/resources/org/springframework/web/socket/server/config/xml/websocket-config-handlers-sockjs-attributes.xml → spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-handlers-sockjs-attributes.xml

@ -1,19 +1,3 @@ @@ -1,19 +1,3 @@
<!--
~ 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
@ -22,7 +6,7 @@ @@ -22,7 +6,7 @@
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:handlers >
<websocket:mapping path="/test" handler="testHandler" />
<websocket:mapping path="/test" handler="testHandler"/>
<websocket:sockjs task-scheduler="testTaskScheduler"
name="testSockJsService"
websocket-enabled="false"
@ -33,18 +17,18 @@ @@ -33,18 +17,18 @@
heartbeat-time="20">
<websocket:transport-handlers register-defaults="false">
<bean class="org.springframework.web.socket.sockjs.transport.handler.XhrPollingTransportHandler"/>
<ref bean="xhrStreamingTransportHandler" />
<ref bean="xhrStreamingTransportHandler"/>
</websocket:transport-handlers>
</websocket:sockjs>
</websocket:handlers>
<bean id="testHandler"
class="org.springframework.web.socket.server.config.xml.TestWebSocketHandler" />
class="org.springframework.web.socket.config.TestWebSocketHandler"/>
<bean id="xhrStreamingTransportHandler"
class="org.springframework.web.socket.sockjs.transport.handler.XhrStreamingTransportHandler" />
class="org.springframework.web.socket.sockjs.transport.handler.XhrStreamingTransportHandler"/>
<bean id="testTaskScheduler"
class="org.springframework.web.socket.server.config.xml.TestTaskScheduler" />
class="org.springframework.web.socket.config.TestTaskScheduler"/>
</beans>

17
spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-handlers-sockjs.xml

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:handlers>
<websocket:mapping path="/test" handler="testHandler"/>
<websocket:mapping path="/foo/" handler="fooHandler"/>
<websocket:sockjs/>
</websocket:handlers>
<bean id="testHandler" class="org.springframework.web.socket.config.TestWebSocketHandler"/>
<bean id="fooHandler" class="org.springframework.web.socket.config.FooWebSocketHandler"/>
</beans>

19
spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-handlers.xml

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:handlers>
<websocket:mapping path="/foo,/bar" handler="fooHandler"/>
</websocket:handlers>
<websocket:handlers>
<websocket:mapping path="/test" handler="testHandler"/>
</websocket:handlers>
<bean id="testHandler" class="org.springframework.web.socket.config.TestWebSocketHandler"/>
<bean id="fooHandler" class="org.springframework.web.socket.config.FooWebSocketHandler"/>
</beans>

35
spring-websocket/src/test/resources/org/springframework/web/socket/messaging/config/xml/websocket-config-broker-simple.xml

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
<!--
~ 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:message-broker application-destination-prefix="/app" user-destination-prefix="/personal">
<websocket:stomp-endpoint path=" /foo,/bar">
<websocket:handshake-handler ref="myHandler" />
</websocket:stomp-endpoint>
<websocket:stomp-endpoint path="/test,/sockjs">
<websocket:handshake-handler ref="myHandler" />
<websocket:sockjs />
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic" />
</websocket:message-broker>
<bean id="myHandler" class="org.springframework.web.socket.server.config.xml.TestHandshakeHandler" />
</beans>

40
spring-websocket/src/test/resources/org/springframework/web/socket/server/config/xml/websocket-config-handlers-attributes.xml

@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
<!--
~ 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:handlers order="2">
<websocket:mapping path="/foo" handler="fooHandler" />
<websocket:mapping path="/test" handler="testHandler" />
<websocket:handshake-handler ref="testHandshakeHandler" />
<websocket:handshake-interceptors>
<bean class="org.springframework.web.socket.server.config.xml.FooTestInterceptor"/>
<ref bean="barTestInterceptor" />
</websocket:handshake-interceptors>
</websocket:handlers>
<bean id="testHandler" class="org.springframework.web.socket.server.config.xml.TestWebSocketHandler" />
<bean id="fooHandler" class="org.springframework.web.socket.server.config.xml.FooWebSocketHandler" />
<bean id="barTestInterceptor" class="org.springframework.web.socket.server.config.xml.BarTestInterceptor"/>
<bean id="testHandshakeHandler" class="org.springframework.web.socket.server.config.xml.TestHandshakeHandler" />
</beans>

33
spring-websocket/src/test/resources/org/springframework/web/socket/server/config/xml/websocket-config-handlers-sockjs.xml

@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
<!--
~ 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:handlers>
<websocket:mapping path="/test" handler="testHandler" />
<websocket:mapping path="/foo/" handler="fooHandler" />
<websocket:sockjs/>
</websocket:handlers>
<bean id="testHandler" class="org.springframework.web.socket.server.config.xml.TestWebSocketHandler" />
<bean id="fooHandler" class="org.springframework.web.socket.server.config.xml.FooWebSocketHandler" />
</beans>

35
spring-websocket/src/test/resources/org/springframework/web/socket/server/config/xml/websocket-config-handlers.xml

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
<!--
~ 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd">
<websocket:handlers>
<websocket:mapping path="/foo,/bar" handler="fooHandler" />
</websocket:handlers>
<websocket:handlers>
<websocket:mapping path="/test" handler="testHandler" />
</websocket:handlers>
<bean id="testHandler" class="org.springframework.web.socket.server.config.xml.TestWebSocketHandler" />
<bean id="fooHandler" class="org.springframework.web.socket.server.config.xml.FooWebSocketHandler" />
</beans>
Loading…
Cancel
Save