Browse Source

Update websocket xml namespace attributes

pull/423/head
Rossen Stoyanchev 11 years ago
parent
commit
bb5a53f7f7
  1. 30
      spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java
  2. 4
      spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketNamespaceUtils.java
  3. 12
      spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket-4.0.xsd
  4. 10
      spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-broker-relay.xml
  5. 11
      spring-websocket/src/test/resources/org/springframework/web/socket/config/websocket-config-handlers-sockjs-attributes.xml

30
spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java

@ -304,25 +304,25 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser { @@ -304,25 +304,25 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
if(!relayPort.isEmpty()) {
mpvs.add("relayPort", Integer.valueOf(relayPort));
}
String systemLogin = brokerRelayElem.getAttribute("system-login");
if(!systemLogin.isEmpty()) {
mpvs.add("systemLogin",systemLogin);
String attrValue = brokerRelayElem.getAttribute("login");
if(!attrValue.isEmpty()) {
mpvs.add("systemLogin",attrValue);
}
String systemPasscode = brokerRelayElem.getAttribute("system-passcode");
if(!systemPasscode.isEmpty()) {
mpvs.add("systemPasscode",systemPasscode);
attrValue = brokerRelayElem.getAttribute("passcode");
if(!attrValue.isEmpty()) {
mpvs.add("systemPasscode", attrValue);
}
String systemHeartbeatSendInterval = brokerRelayElem.getAttribute("system-heartbeat-send-interval");
if(!systemHeartbeatSendInterval.isEmpty()) {
mpvs.add("systemHeartbeatSendInterval",Long.parseLong(systemHeartbeatSendInterval));
attrValue = brokerRelayElem.getAttribute("heartbeat-send-interval");
if(!attrValue.isEmpty()) {
mpvs.add("systemHeartbeatSendInterval", Long.parseLong(attrValue));
}
String systemHeartbeatReceiveInterval = brokerRelayElem.getAttribute("system-heartbeat-receive-interval");
if(!systemHeartbeatReceiveInterval.isEmpty()) {
mpvs.add("systemHeartbeatReceiveInterval",Long.parseLong(systemHeartbeatReceiveInterval));
attrValue = brokerRelayElem.getAttribute("heartbeat-receive-interval");
if(!attrValue.isEmpty()) {
mpvs.add("systemHeartbeatReceiveInterval", Long.parseLong(attrValue));
}
String virtualHost = brokerRelayElem.getAttribute("virtual-host");
if(!virtualHost.isEmpty()) {
mpvs.add("virtualHost",virtualHost);
attrValue = brokerRelayElem.getAttribute("virtual-host");
if(!attrValue.isEmpty()) {
mpvs.add("virtualHost", attrValue);
}
Class<?> handlerType = StompBrokerRelayMessageHandler.class;

4
spring-websocket/src/main/java/org/springframework/web/socket/config/WebSocketNamespaceUtils.java

@ -67,7 +67,7 @@ class WebSocketNamespaceUtils { @@ -67,7 +67,7 @@ class WebSocketNamespaceUtils {
// TODO: polish the way constructor arguments are set
String customTaskSchedulerName = sockJsElement.getAttribute("task-scheduler");
String customTaskSchedulerName = sockJsElement.getAttribute("scheduler");
if (!customTaskSchedulerName.isEmpty()) {
cavs.addIndexedArgumentValue(0, new RuntimeBeanReference(customTaskSchedulerName));
}
@ -126,7 +126,7 @@ class WebSocketNamespaceUtils { @@ -126,7 +126,7 @@ class WebSocketNamespaceUtils {
if (!attrValue.isEmpty()) {
sockJsServiceDef.getPropertyValues().add("disconnectDelay", Long.valueOf(attrValue));
}
attrValue = sockJsElement.getAttribute("http-message-cache-size");
attrValue = sockJsElement.getAttribute("message-cache-size");
if (!attrValue.isEmpty()) {
sockJsServiceDef.getPropertyValues().add("httpMessageCacheSize", Integer.valueOf(attrValue));
}

12
spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket-4.0.xsd

@ -100,11 +100,11 @@ @@ -100,11 +100,11 @@
</xsd:attribute>
<xsd:attribute name="disconnect-delay" type="xsd:long">
</xsd:attribute>
<xsd:attribute name="http-message-cache-size" type="xsd:long">
<xsd:attribute name="message-cache-size" type="xsd:long">
</xsd:attribute>
<xsd:attribute name="websocket-enabled" type="xsd:boolean">
</xsd:attribute>
<xsd:attribute name="task-scheduler" type="xsd:string">
<xsd:attribute name="scheduler" type="xsd:string">
</xsd:attribute>
</xsd:complexType>
@ -112,10 +112,10 @@ @@ -112,10 +112,10 @@
<xsd:attribute name="prefix" type="xsd:string"></xsd:attribute>
<xsd:attribute name="relay-host" type="xsd:string"></xsd:attribute>
<xsd:attribute name="relay-port" type="xsd:integer"></xsd:attribute>
<xsd:attribute name="system-login" type="xsd:string"></xsd:attribute>
<xsd:attribute name="system-passcode" type="xsd:string"></xsd:attribute>
<xsd:attribute name="system-heartbeat-send-interval" type="xsd:long"></xsd:attribute>
<xsd:attribute name="system-heartbeat-receive-interval" type="xsd:long"></xsd:attribute>
<xsd:attribute name="login" type="xsd:string"></xsd:attribute>
<xsd:attribute name="passcode" type="xsd:string"></xsd:attribute>
<xsd:attribute name="heartbeat-send-interval" type="xsd:long"></xsd:attribute>
<xsd:attribute name="heartbeat-receive-interval" type="xsd:long"></xsd:attribute>
<xsd:attribute name="auto-startup" type="xsd:boolean"></xsd:attribute>
<xsd:attribute name="virtual-host" type="xsd:string"></xsd:attribute>
</xsd:complexType>

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

@ -9,14 +9,8 @@ @@ -9,14 +9,8 @@
<websocket:handshake-handler ref="myHandler"/>
<websocket:sockjs/>
</websocket:stomp-endpoint>
<websocket:stomp-broker-relay
prefix="/topic,/queue"
relay-host="relayhost"
relay-port="1234"
system-login="login"
system-passcode="pass"
system-heartbeat-send-interval="5000"
system-heartbeat-receive-interval="5000"
<websocket:stomp-broker-relay prefix="/topic,/queue" relay-host="relayhost" relay-port="1234"
login="login" passcode="pass" heartbeat-send-interval="5000" heartbeat-receive-interval="5000"
virtual-host="spring.io"/>
</websocket:message-broker>

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

@ -7,14 +7,9 @@ @@ -7,14 +7,9 @@
<websocket:handlers >
<websocket:mapping path="/test" handler="testHandler"/>
<websocket:sockjs task-scheduler="testTaskScheduler"
name="testSockJsService"
websocket-enabled="false"
session-cookie-needed="false"
stream-bytes-limit="2048"
disconnect-delay="256"
http-message-cache-size="1024"
heartbeat-time="20">
<websocket:sockjs name="testSockJsService" scheduler="testTaskScheduler" websocket-enabled="false"
session-cookie-needed="false" stream-bytes-limit="2048" disconnect-delay="256"
message-cache-size="1024" heartbeat-time="20">
<websocket:transport-handlers register-defaults="false">
<bean class="org.springframework.web.socket.sockjs.transport.handler.XhrPollingTransportHandler"/>
<ref bean="xhrStreamingTransportHandler"/>

Loading…
Cancel
Save