Rearranged web.socket.server subpackages and introduced web.socket.config
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user