Rearranged web.socket.server subpackages and introduced web.socket.config
This commit is contained in:
parent
eb8b5c435c
commit
e3e1c1bcec
|
@ -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;
|
|||
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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|||
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;
|
|||
* @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,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;
|
|||
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;
|
|||
* @author Rossen Stoyanchev
|
||||
* @since 4.0
|
||||
*/
|
||||
public class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
||||
class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
protected static final String SOCKJS_SCHEDULER_BEAN_NAME = "messageBrokerSockJsScheduler";
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
||||
|
|
@ -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;
|
|
@ -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;
|
||||
|
|
@ -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 {
|
|||
registerBeanDefinitionParser("message-broker", new MessageBrokerBeanDefinitionParser());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
|||
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;
|
|||
* @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 {
|
|||
String handlerName = parserContext.getReaderContext().registerWithGeneratedName(defaultHandlerDef);
|
||||
handlerRef = new RuntimeBeanReference(handlerName);
|
||||
}
|
||||
|
||||
return handlerRef;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
|||
|
||||
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 {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if(transportHandlersList.isEmpty()) {
|
||||
if (transportHandlersList.isEmpty()) {
|
||||
cavs.addIndexedArgumentValue(1, new ConstructorArgumentValues.ValueHolder(null));
|
||||
}
|
||||
else {
|
||||
|
@ -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));
|
||||
}
|
||||
|
|
@ -17,5 +17,5 @@
|
|||
/**
|
||||
* Configuration support for WebSocket request handling.
|
||||
*/
|
||||
package org.springframework.web.socket.server.config;
|
||||
package org.springframework.web.socket.config;
|
||||
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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;
|
|||
|
||||
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;
|
|||
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.
|
||||
*
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|||
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;
|
|||
*
|
||||
* <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
|
|||
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
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServerContainer getObject() {
|
||||
return this.serverContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return ServerContainer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
|
@ -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
|
||||
|
|
|
@ -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;
|
|||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.*;
|
||||
|
|
|
@ -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;
|
|||
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;
|
|
@ -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;
|
|||
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;
|
|
@ -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;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -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 {
|
|||
|
||||
@Test
|
||||
public void stompBrokerRelay() {
|
||||
|
||||
loadBeanDefinitions("websocket-config-broker-relay.xml");
|
||||
|
||||
HandlerMapping hm = this.appContext.getBean(HandlerMapping.class);
|
||||
|
@ -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 {
|
|||
|
||||
@Test
|
||||
public void customChannels() {
|
||||
|
||||
loadBeanDefinitions("websocket-config-broker-customchannels.xml");
|
||||
|
||||
List<Class<? extends MessageHandler>> subscriberTypes =
|
|
@ -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;
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
|||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* Test fixture for {@link DefaultHandshakeHandler}.
|
||||
* Test fixture for {@link org.springframework.web.socket.server.support.DefaultHandshakeHandler}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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.*;
|
||||
|
||||
|
|
|
@ -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 @@
|
|||
|
||||
<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>
|
|
@ -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 @@
|
|||
|
||||
<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 @@
|
|||
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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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 @@
|
|||
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 @@
|
|||
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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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…
Reference in New Issue