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

This commit is contained in:
Juergen Hoeller
2013-12-02 22:31:57 +01:00
committed by unknown
parent eb8b5c435c
commit e3e1c1bcec
55 changed files with 210 additions and 420 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -14,7 +14,7 @@
* limitations under the License. * 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.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * 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.WebSocketHandler;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * 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.WebSocketHandler;
import org.springframework.web.socket.server.HandshakeHandler; import org.springframework.web.socket.server.HandshakeHandler;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * 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.WebSocketHandler;

View File

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

View File

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

View File

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

View File

@@ -17,7 +17,7 @@
package org.springframework.web.socket.messaging.config; package org.springframework.web.socket.messaging.config;
import org.springframework.web.socket.server.HandshakeHandler; 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. * A contract for configuring a STOMP over WebSocket endpoint.

View File

@@ -23,7 +23,7 @@ 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.server.config.SockJsServiceRegistration; 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;

View File

@@ -21,7 +21,7 @@ import org.springframework.messaging.simp.config.AbstractMessageBrokerConfigurat
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.server.config.SockJsServiceRegistration; import org.springframework.web.socket.config.SockJsServiceRegistration;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler; import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
/** /**

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -50,8 +50,6 @@ import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.socket.server.HandshakeFailureException; 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 * GlassFish support for upgrading a request during a WebSocket handshake. To modify

View File

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

View File

@@ -14,7 +14,7 @@
* limitations under the License. * 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.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * 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.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

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

View File

@@ -14,7 +14,7 @@
* limitations under the License. * 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.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;

View File

@@ -35,8 +35,6 @@ import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.http.server.ServletServerHttpResponse; import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.web.socket.server.HandshakeFailureException; 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 * Tomcat support for upgrading an {@link HttpServletRequest} during a WebSocket

View File

@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -33,7 +32,6 @@ import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.util.Assert; import org.springframework.util.Assert;
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.DefaultHandshakeHandler;
import org.springframework.web.socket.server.HandshakeFailureException; import org.springframework.web.socket.server.HandshakeFailureException;
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;

View File

@@ -40,10 +40,10 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketSession; 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.HandshakeFailureException;
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;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.support.HandshakeInterceptorChain; import org.springframework.web.socket.server.support.HandshakeInterceptorChain;
import org.springframework.web.socket.sockjs.SockJsException; import org.springframework.web.socket.sockjs.SockJsException;
import org.springframework.web.socket.sockjs.SockJsService; import org.springframework.web.socket.sockjs.SockJsService;

View File

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

View File

@@ -1,18 +1,2 @@
# http\://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd=org/springframework/web/socket/config/spring-websocket-4.0.xsd
# Copyright 2002-2013 the original author or authors. http\://www.springframework.org/schema/websocket/spring-websocket.xsd=org/springframework/web/socket/config/spring-websocket-4.0.xsd
#
# 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

View File

@@ -29,7 +29,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.util.concurrent.ListenableFuture; import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.socket.client.WebSocketClient; 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.RequestUpgradeStrategy;
import org.springframework.web.socket.server.support.JettyRequestUpgradeStrategy; import org.springframework.web.socket.server.support.JettyRequestUpgradeStrategy;
import org.springframework.web.socket.server.support.TomcatRequestUpgradeStrategy; import org.springframework.web.socket.server.support.TomcatRequestUpgradeStrategy;

View File

@@ -30,10 +30,10 @@ import org.springframework.web.socket.adapter.TextWebSocketHandlerAdapter;
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.server.DefaultHandshakeHandler; import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
import org.springframework.web.socket.server.config.EnableWebSocket; import org.springframework.web.socket.config.EnableWebSocket;
import org.springframework.web.socket.server.config.WebSocketConfigurer; import org.springframework.web.socket.config.WebSocketConfigurer;
import org.springframework.web.socket.server.config.WebSocketHandlerRegistry; import org.springframework.web.socket.config.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.*;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.server.config; package org.springframework.web.socket.config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@@ -26,7 +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.server.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;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor; import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.web.socket.server.config.xml; package org.springframework.web.socket.config;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Before; import org.junit.Before;
@@ -34,7 +34,7 @@ import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketMessage; import org.springframework.web.socket.WebSocketMessage;
import org.springframework.web.socket.WebSocketSession; 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.HandshakeFailureException;
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;

View File

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

View File

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

View File

@@ -28,7 +28,7 @@ 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.messaging.SubProtocolWebSocketHandler; 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.server.support.WebSocketHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler; import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
import org.springframework.web.socket.sockjs.transport.TransportType; import org.springframework.web.socket.sockjs.transport.TransportType;

View File

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

View File

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

View File

@@ -26,11 +26,12 @@ import org.springframework.context.ConfigurableApplicationContext;
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;
import org.springframework.web.socket.server.support.ServerEndpointRegistration;
import static org.junit.Assert.*; import static org.junit.Assert.*;
/** /**
* Test fixture for {@link ServerEndpointRegistration}. * Test fixture for {@link org.springframework.web.socket.server.support.ServerEndpointRegistration}.
* *
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
*/ */

View File

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

View File

@@ -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" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket" xmlns:websocket="http://www.springframework.org/schema/websocket"
@@ -22,29 +6,29 @@
<websocket:message-broker application-destination-prefix="/app" user-destination-prefix="/personal"> <websocket:message-broker application-destination-prefix="/app" user-destination-prefix="/personal">
<websocket:stomp-endpoint path="/foo,/bar"> <websocket:stomp-endpoint path="/foo,/bar">
<websocket:handshake-handler ref="myHandler" /> <websocket:handshake-handler ref="myHandler"/>
</websocket:stomp-endpoint> </websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic" /> <websocket:simple-broker prefix="/topic"/>
<websocket:client-inbound-channel> <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> <websocket:interceptors>
<ref bean="myInterceptor" /> <ref bean="myInterceptor"/>
</websocket:interceptors> </websocket:interceptors>
</websocket:client-inbound-channel> </websocket:client-inbound-channel>
<websocket:client-outbound-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> <websocket:interceptors>
<ref bean="myInterceptor" /> <ref bean="myInterceptor"/>
<bean class="org.springframework.messaging.support.channel.ChannelInterceptorAdapter" /> <bean class="org.springframework.messaging.support.channel.ChannelInterceptorAdapter"/>
</websocket:interceptors> </websocket:interceptors>
</websocket:client-outbound-channel> </websocket:client-outbound-channel>
<websocket:broker-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:broker-channel>
</websocket:message-broker> </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> </beans>

View File

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

View File

@@ -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>

View File

@@ -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>

View File

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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>