Browse Source

Javadocs and general formatting polish

pull/292/head
Phillip Webb 13 years ago
parent
commit
db2c2480db
  1. 3
      spring-websocket/src/main/java/org/springframework/sockjs/AbstractSockJsSession.java
  2. 8
      spring-websocket/src/main/java/org/springframework/sockjs/SockJsSessionFactory.java
  3. 16
      spring-websocket/src/main/java/org/springframework/sockjs/package-info.java
  4. 1
      spring-websocket/src/main/java/org/springframework/sockjs/server/AbstractServerSockJsSession.java
  5. 1
      spring-websocket/src/main/java/org/springframework/sockjs/server/AbstractSockJsService.java
  6. 2
      spring-websocket/src/main/java/org/springframework/sockjs/server/ConfigurableTransportHandler.java
  7. 2
      spring-websocket/src/main/java/org/springframework/sockjs/server/NestedSockJsRuntimeException.java
  8. 2
      spring-websocket/src/main/java/org/springframework/sockjs/server/SockJsConfiguration.java
  9. 5
      spring-websocket/src/main/java/org/springframework/sockjs/server/SockJsFrame.java
  10. 3
      spring-websocket/src/main/java/org/springframework/sockjs/server/SockJsService.java
  11. 3
      spring-websocket/src/main/java/org/springframework/sockjs/server/TransportHandler.java
  12. 3
      spring-websocket/src/main/java/org/springframework/sockjs/server/TransportType.java
  13. 16
      spring-websocket/src/main/java/org/springframework/sockjs/server/package-info.java
  14. 1
      spring-websocket/src/main/java/org/springframework/sockjs/server/support/DefaultSockJsService.java
  15. 3
      spring-websocket/src/main/java/org/springframework/sockjs/server/support/SockJsHttpRequestHandler.java
  16. 15
      spring-websocket/src/main/java/org/springframework/sockjs/server/support/package-info.java
  17. 2
      spring-websocket/src/main/java/org/springframework/sockjs/server/transport/AbstractHttpReceivingTransportHandler.java
  18. 3
      spring-websocket/src/main/java/org/springframework/sockjs/server/transport/AbstractHttpSendingTransportHandler.java
  19. 1
      spring-websocket/src/main/java/org/springframework/sockjs/server/transport/AbstractHttpServerSockJsSession.java
  20. 3
      spring-websocket/src/main/java/org/springframework/sockjs/server/transport/EventSourceTransportHandler.java
  21. 2
      spring-websocket/src/main/java/org/springframework/sockjs/server/transport/HtmlFileTransportHandler.java
  22. 3
      spring-websocket/src/main/java/org/springframework/sockjs/server/transport/JsonpPollingTransportHandler.java
  23. 2
      spring-websocket/src/main/java/org/springframework/sockjs/server/transport/JsonpTransportHandler.java
  24. 3
      spring-websocket/src/main/java/org/springframework/sockjs/server/transport/StreamingServerSockJsSession.java
  25. 15
      spring-websocket/src/main/java/org/springframework/sockjs/server/transport/package-info.java
  26. 49
      spring-websocket/src/main/java/org/springframework/websocket/BinaryMessage.java
  27. 42
      spring-websocket/src/main/java/org/springframework/websocket/CloseStatus.java
  28. 2
      spring-websocket/src/main/java/org/springframework/websocket/HandlerProvider.java
  29. 2
      spring-websocket/src/main/java/org/springframework/websocket/PartialMessageHandler.java
  30. 14
      spring-websocket/src/main/java/org/springframework/websocket/TextMessage.java
  31. 2
      spring-websocket/src/main/java/org/springframework/websocket/WebSocketHandler.java
  32. 1
      spring-websocket/src/main/java/org/springframework/websocket/WebSocketHandlerAdapter.java
  33. 15
      spring-websocket/src/main/java/org/springframework/websocket/WebSocketMessage.java
  34. 1
      spring-websocket/src/main/java/org/springframework/websocket/WebSocketSession.java
  35. 4
      spring-websocket/src/main/java/org/springframework/websocket/client/AbstractWebSocketConnectionManager.java
  36. 2
      spring-websocket/src/main/java/org/springframework/websocket/client/WebSocketClient.java
  37. 4
      spring-websocket/src/main/java/org/springframework/websocket/client/WebSocketConnectFailureException.java
  38. 4
      spring-websocket/src/main/java/org/springframework/websocket/client/WebSocketConnectionManager.java
  39. 3
      spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/AnnotatedEndpointConnectionManager.java
  40. 3
      spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/EndpointConnectionManager.java
  41. 3
      spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/EndpointConnectionManagerSupport.java
  42. 2
      spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/StandardWebSocketClient.java
  43. 2
      spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/WebSocketContainerFactoryBean.java
  44. 16
      spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/package-info.java
  45. 17
      spring-websocket/src/main/java/org/springframework/websocket/client/package-info.java
  46. 2
      spring-websocket/src/main/java/org/springframework/websocket/endpoint/StandardWebSocketSession.java
  47. 1
      spring-websocket/src/main/java/org/springframework/websocket/endpoint/WebSocketHandlerEndpoint.java
  48. 16
      spring-websocket/src/main/java/org/springframework/websocket/endpoint/package-info.java
  49. 16
      spring-websocket/src/main/java/org/springframework/websocket/package-info.java
  50. 2
      spring-websocket/src/main/java/org/springframework/websocket/server/DefaultHandshakeHandler.java
  51. 1
      spring-websocket/src/main/java/org/springframework/websocket/server/HandshakeHandler.java
  52. 1
      spring-websocket/src/main/java/org/springframework/websocket/server/RequestUpgradeStrategy.java
  53. 1
      spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/EndpointExporter.java
  54. 1
      spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/EndpointRegistration.java
  55. 4
      spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/ServletServerContainerFactoryBean.java
  56. 1
      spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/SpringConfigurator.java
  57. 15
      spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/package-info.java
  58. 16
      spring-websocket/src/main/java/org/springframework/websocket/server/package-info.java
  59. 1
      spring-websocket/src/main/java/org/springframework/websocket/server/support/AbstractEndpointUpgradeStrategy.java
  60. 1
      spring-websocket/src/main/java/org/springframework/websocket/server/support/JettyRequestUpgradeStrategy.java
  61. 2
      spring-websocket/src/main/java/org/springframework/websocket/server/support/TomcatRequestUpgradeStrategy.java
  62. 2
      spring-websocket/src/main/java/org/springframework/websocket/server/support/WebSocketHttpRequestHandler.java
  63. 19
      spring-websocket/src/main/java/org/springframework/websocket/server/support/package-info.java
  64. 2
      spring-websocket/src/main/java/org/springframework/websocket/support/BeanCreatingHandlerProvider.java
  65. 3
      spring-websocket/src/main/java/org/springframework/websocket/support/SimpleHandlerProvider.java

3
spring-websocket/src/main/java/org/springframework/sockjs/AbstractSockJsSession.java

@ -37,7 +37,8 @@ import org.springframework.websocket.WebSocketSession; @@ -37,7 +37,8 @@ import org.springframework.websocket.WebSocketSession;
*/
public abstract class AbstractSockJsSession implements WebSocketSession {
protected Log logger = LogFactory.getLog(this.getClass());
protected final Log logger = LogFactory.getLog(getClass());
private final String sessionId;

8
spring-websocket/src/main/java/org/springframework/sockjs/SockJsSessionFactory.java

@ -20,15 +20,21 @@ import org.springframework.websocket.HandlerProvider; @@ -20,15 +20,21 @@ import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
import org.springframework.websocket.WebSocketSession;
/**
* A factory for creating a SockJS session.
*
* @param <S> The type of session being created
* @author Rossen Stoyanchev
* @since 4.0
*/
public interface SockJsSessionFactory<S extends WebSocketSession>{
/**
* Create a new SockJS session.
* @param sessionId the ID of the session
* @param handler the underlying {@link WebSocketHandler}
* @return a new non-null session
*/
S createSession(String sessionId, HandlerProvider<WebSocketHandler> handler);
}

16
spring-websocket/src/main/java/org/springframework/sockjs/package-info.java

@ -1,7 +1,21 @@ @@ -1,7 +1,21 @@
/*
* 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.
*/
/**
* Common abstractions and Spring configuration support for the SockJS protocol.
*
*/
package org.springframework.sockjs;

1
spring-websocket/src/main/java/org/springframework/sockjs/server/AbstractServerSockJsSession.java

@ -30,7 +30,6 @@ import org.springframework.websocket.TextMessage; @@ -30,7 +30,6 @@ import org.springframework.websocket.TextMessage;
import org.springframework.websocket.WebSocketHandler;
import org.springframework.websocket.WebSocketMessage;
/**
* Provides partial implementations of {@link SockJsSession} methods to send messages,
* including heartbeat messages and to manage session state.

1
spring-websocket/src/main/java/org/springframework/sockjs/server/AbstractSockJsService.java

@ -39,7 +39,6 @@ import org.springframework.util.StringUtils; @@ -39,7 +39,6 @@ import org.springframework.util.StringUtils;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
/**
* Provides support for SockJS configuration options and serves the static SockJS URLs.
*

2
spring-websocket/src/main/java/org/springframework/sockjs/server/ConfigurableTransportHandler.java

@ -16,9 +16,7 @@ @@ -16,9 +16,7 @@
package org.springframework.sockjs.server;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/

2
spring-websocket/src/main/java/org/springframework/sockjs/server/NestedSockJsRuntimeException.java

@ -18,7 +18,6 @@ package org.springframework.sockjs.server; @@ -18,7 +18,6 @@ package org.springframework.sockjs.server;
import org.springframework.core.NestedRuntimeException;
/**
*
* @author Rossen Stoyanchev
@ -27,7 +26,6 @@ import org.springframework.core.NestedRuntimeException; @@ -27,7 +26,6 @@ import org.springframework.core.NestedRuntimeException;
@SuppressWarnings("serial")
public class NestedSockJsRuntimeException extends NestedRuntimeException {
public NestedSockJsRuntimeException(String msg) {
super(msg);
}

2
spring-websocket/src/main/java/org/springframework/sockjs/server/SockJsConfiguration.java

@ -13,13 +13,13 @@ @@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/

5
spring-websocket/src/main/java/org/springframework/sockjs/server/SockJsFrame.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server;
import java.nio.charset.Charset;
@ -21,10 +22,7 @@ import org.springframework.util.Assert; @@ -21,10 +22,7 @@ import org.springframework.util.Assert;
import com.fasterxml.jackson.core.io.JsonStringEncoder;
/**
*
*
* @author Rossen Stoyanchev
* @since 4.0
*/
@ -46,6 +44,7 @@ public class SockJsFrame { @@ -46,6 +44,7 @@ public class SockJsFrame {
this.content = content;
}
public static SockJsFrame openFrame() {
return OPEN_FRAME;
}

3
spring-websocket/src/main/java/org/springframework/sockjs/server/SockJsService.java

@ -23,15 +23,12 @@ import org.springframework.http.server.ServerHttpResponse; @@ -23,15 +23,12 @@ import org.springframework.http.server.ServerHttpResponse;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/
public interface SockJsService {
void handleRequest(ServerHttpRequest request, ServerHttpResponse response, String sockJsPath,
HandlerProvider<WebSocketHandler> handler) throws IOException, TransportErrorException;

3
spring-websocket/src/main/java/org/springframework/sockjs/server/TransportHandler.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server;
import org.springframework.http.server.ServerHttpRequest;
@ -21,9 +22,7 @@ import org.springframework.sockjs.AbstractSockJsSession; @@ -21,9 +22,7 @@ import org.springframework.sockjs.AbstractSockJsSession;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/

3
spring-websocket/src/main/java/org/springframework/sockjs/server/TransportType.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server;
import java.util.Arrays;
@ -20,9 +21,7 @@ import java.util.List; @@ -20,9 +21,7 @@ import java.util.List;
import org.springframework.http.HttpMethod;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/

16
spring-websocket/src/main/java/org/springframework/sockjs/server/package-info.java

@ -1,7 +1,21 @@ @@ -1,7 +1,21 @@
/*
* 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-side SockJS abstractions and base classes.
*
*/
package org.springframework.sockjs.server;

1
spring-websocket/src/main/java/org/springframework/sockjs/server/support/DefaultSockJsService.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server.support;
import java.io.IOException;

3
spring-websocket/src/main/java/org/springframework/sockjs/server/support/SockJsHttpRequestHandler.java

@ -35,9 +35,7 @@ import org.springframework.websocket.HandlerProvider; @@ -35,9 +35,7 @@ import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
import org.springframework.websocket.support.SimpleHandlerProvider;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/
@ -89,6 +87,7 @@ public class SockJsHttpRequestHandler implements HttpRequestHandler { @@ -89,6 +87,7 @@ public class SockJsHttpRequestHandler implements HttpRequestHandler {
this.handlerProvider = handlerProvider;
}
public String getPrefix() {
return this.prefix;
}

15
spring-websocket/src/main/java/org/springframework/sockjs/server/support/package-info.java

@ -1,3 +1,18 @@ @@ -1,3 +1,18 @@
/*
* 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-side SockJS classes including a

2
spring-websocket/src/main/java/org/springframework/sockjs/server/transport/AbstractHttpReceivingTransportHandler.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server.transport;
import java.io.IOException;
@ -34,7 +35,6 @@ import org.springframework.websocket.WebSocketHandler; @@ -34,7 +35,6 @@ import org.springframework.websocket.WebSocketHandler;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* TODO
*

3
spring-websocket/src/main/java/org/springframework/sockjs/server/transport/AbstractHttpSendingTransportHandler.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server.transport;
import java.io.IOException;
@ -94,4 +95,4 @@ public abstract class AbstractHttpSendingTransportHandler @@ -94,4 +95,4 @@ public abstract class AbstractHttpSendingTransportHandler
protected abstract FrameFormat getFrameFormat(ServerHttpRequest request);
}
}

1
spring-websocket/src/main/java/org/springframework/sockjs/server/transport/AbstractHttpServerSockJsSession.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server.transport;
import java.io.IOException;

3
spring-websocket/src/main/java/org/springframework/sockjs/server/transport/EventSourceTransportHandler.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server.transport;
import java.io.IOException;
@ -27,7 +28,6 @@ import org.springframework.util.Assert; @@ -27,7 +28,6 @@ import org.springframework.util.Assert;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
/**
* TODO
*
@ -36,7 +36,6 @@ import org.springframework.websocket.WebSocketHandler; @@ -36,7 +36,6 @@ import org.springframework.websocket.WebSocketHandler;
*/
public class EventSourceTransportHandler extends AbstractHttpSendingTransportHandler {
@Override
public TransportType getTransportType() {
return TransportType.EVENT_SOURCE;

2
spring-websocket/src/main/java/org/springframework/sockjs/server/transport/HtmlFileTransportHandler.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server.transport;
import java.io.IOException;
@ -32,7 +33,6 @@ import org.springframework.web.util.JavaScriptUtils; @@ -32,7 +33,6 @@ import org.springframework.web.util.JavaScriptUtils;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
/**
* TODO
*

3
spring-websocket/src/main/java/org/springframework/sockjs/server/transport/JsonpPollingTransportHandler.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server.transport;
import java.nio.charset.Charset;
@ -31,7 +32,6 @@ import org.springframework.web.util.JavaScriptUtils; @@ -31,7 +32,6 @@ import org.springframework.web.util.JavaScriptUtils;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
/**
* TODO
*
@ -40,7 +40,6 @@ import org.springframework.websocket.WebSocketHandler; @@ -40,7 +40,6 @@ import org.springframework.websocket.WebSocketHandler;
*/
public class JsonpPollingTransportHandler extends AbstractHttpSendingTransportHandler {
@Override
public TransportType getTransportType() {
return TransportType.JSONP;

2
spring-websocket/src/main/java/org/springframework/sockjs/server/transport/JsonpTransportHandler.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server.transport;
import java.io.IOException;
@ -27,7 +28,6 @@ import org.springframework.sockjs.server.TransportType; @@ -27,7 +28,6 @@ import org.springframework.sockjs.server.TransportType;
public class JsonpTransportHandler extends AbstractHttpReceivingTransportHandler {
@Override
public TransportType getTransportType() {
return TransportType.JSONP_SEND;

3
spring-websocket/src/main/java/org/springframework/sockjs/server/transport/StreamingServerSockJsSession.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.sockjs.server.transport;
import java.io.IOException;
@ -26,7 +27,6 @@ import org.springframework.sockjs.server.TransportErrorException; @@ -26,7 +27,6 @@ import org.springframework.sockjs.server.TransportErrorException;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
public class StreamingServerSockJsSession extends AbstractHttpServerSockJsSession {
private int byteCount;
@ -38,6 +38,7 @@ public class StreamingServerSockJsSession extends AbstractHttpServerSockJsSessio @@ -38,6 +38,7 @@ public class StreamingServerSockJsSession extends AbstractHttpServerSockJsSessio
super(sessionId, sockJsConfig, handler);
}
@Override
public synchronized void setInitialRequest(ServerHttpRequest request, ServerHttpResponse response,
FrameFormat frameFormat) throws TransportErrorException {

15
spring-websocket/src/main/java/org/springframework/sockjs/server/transport/package-info.java

@ -1,3 +1,18 @@ @@ -1,3 +1,18 @@
/*
* 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-side support for SockJS transports including

49
spring-websocket/src/main/java/org/springframework/websocket/BinaryMessage.java

@ -23,10 +23,11 @@ import org.springframework.util.Assert; @@ -23,10 +23,11 @@ import org.springframework.util.Assert;
/**
* Represents a binary WebSocket message.
* A {@link WebSocketMessage} that contains a binary {@link ByteBuffer} payload.
*
* @author Rossen Stoyanchev
* @since 4.0
* @see WebSocketMessage
*/
public final class BinaryMessage extends WebSocketMessage<ByteBuffer> {
@ -35,41 +36,80 @@ public final class BinaryMessage extends WebSocketMessage<ByteBuffer> { @@ -35,41 +36,80 @@ public final class BinaryMessage extends WebSocketMessage<ByteBuffer> {
private final boolean last;
/**
* Create a new {@link BinaryMessage} instance.
* @param payload a non-null payload
*/
public BinaryMessage(ByteBuffer payload) {
this(payload, true);
}
/**
* Create a new {@link BinaryMessage} instance.
* @param payload a non-null payload
* @param isLast if the message is the last of a series of partial messages
*/
public BinaryMessage(ByteBuffer payload, boolean isLast) {
super(payload);
this.bytes = null;
this.last = isLast;
}
/**
* Create a new {@link BinaryMessage} instance.
* @param payload a non-null payload
*/
public BinaryMessage(byte[] payload) {
this(payload, true);
}
/**
* Create a new {@link BinaryMessage} instance.
* @param payload a non-null payload
* @param isLast if the message is the last of a series of partial messages
*/
public BinaryMessage(byte[] payload, boolean isLast) {
this(payload, 0, (payload == null ? 0 : payload.length), isLast);
}
/**
* Create a new {@link BinaryMessage} instance by wrapping an existing byte array.
* @param payload a non-null payload, NOTE: this value is not copied so care must be
* taken not to modify the array.
* @param isLast if the message is the last of a series of partial messages
*/
public BinaryMessage(byte[] payload, int offset, int len) {
this(payload, offset, len, true);
}
/**
* Create a new {@link BinaryMessage} instance by wrapping an existing byte array.
* @param payload a non-null payload, NOTE: this value is not copied so care must be
* taken not to modify the array.
* @param offset the offet into the array where the payload starts
* @param len the length of the array considered for the payload
* @param isLast if the message is the last of a series of partial messages
*/
public BinaryMessage(byte[] payload, int offset, int len, boolean isLast) {
super(payload != null ? ByteBuffer.wrap(payload, offset, len) : null);
if(payload != null && offset == 0 && len == payload.length) {
// FIXME better if a message always needs a payload?
if(offset == 0 && len == payload.length) {
this.bytes = payload;
}
this.last = isLast;
}
/**
* Returns if this is the last part in a series of partial messages. If this is
* not a partial message this method will return {@code true}.
*/
public boolean isLast() {
return this.last;
}
/**
* Returns access to the message payload as a byte array. NOTE: the returned array
* should be considered read-only and should not be modified.
*/
public byte[] getByteArray() {
if(this.bytes == null && getPayload() != null) {
this.bytes = getRemainingBytes(getPayload());
@ -83,6 +123,9 @@ public final class BinaryMessage extends WebSocketMessage<ByteBuffer> { @@ -83,6 +123,9 @@ public final class BinaryMessage extends WebSocketMessage<ByteBuffer> {
return result;
}
/**
* Returns access to the message payload as an {@link InputStream}.
*/
public InputStream getInputStream() {
byte[] array = getByteArray();
return (array != null) ? new ByteArrayInputStream(array) : null;

42
spring-websocket/src/main/java/org/springframework/websocket/CloseStatus.java

@ -15,10 +15,10 @@ @@ -15,10 +15,10 @@
*/
package org.springframework.websocket;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* Represents a WebSocket close status code and reason. Status codes in the 1xxx range are
* pre-defined by the protocol. Optionally, a status code may be sent with a reason.
@ -28,11 +28,10 @@ import org.springframework.util.ObjectUtils; @@ -28,11 +28,10 @@ import org.springframework.util.ObjectUtils;
*
* @author Rossen Stoyanchev
* @since 4.0
*
*/
public final class CloseStatus {
/**
/**
* "1000 indicates a normal closure, meaning that the purpose for which the connection
* was established has been fulfilled."
*/
@ -44,13 +43,13 @@ public final class CloseStatus { @@ -44,13 +43,13 @@ public final class CloseStatus {
*/
public static final CloseStatus GOING_AWAY = new CloseStatus(1001);
/**
/**
* "1002 indicates that an endpoint is terminating the connection due to a protocol
* error."
*/
public static final CloseStatus PROTOCOL_ERROR = new CloseStatus(1002);
/**
/**
* "1003 indicates that an endpoint is terminating the connection because it has
* received a type of data it cannot accept (e.g., an endpoint that understands only
* text data MAY send this if it receives a binary message)."
@ -82,7 +81,7 @@ public final class CloseStatus { @@ -82,7 +81,7 @@ public final class CloseStatus {
*/
public static final CloseStatus BAD_DATA = new CloseStatus(1007);
/**
/**
* "1008 indicates that an endpoint is terminating the connection because it has
* received a message that violates its policy. This is a generic status code that can
* be returned when there is no other more suitable status code (e.g., 1003 or 1009)
@ -90,13 +89,13 @@ public final class CloseStatus { @@ -90,13 +89,13 @@ public final class CloseStatus {
*/
public static final CloseStatus POLICY_VIOLATION = new CloseStatus(1008);
/**
/**
* "1009 indicates that an endpoint is terminating the connection because it has
* received a message that is too big for it to process."
*/
public static final CloseStatus TOO_BIG_TO_PROCESS = new CloseStatus(1009);
/**
/**
* "1010 indicates that an endpoint (client) is terminating the connection because it
* has expected the server to negotiate one or more extension, but the server didn't
* return them in the response message of the WebSocket handshake. The list of
@ -106,7 +105,7 @@ public final class CloseStatus { @@ -106,7 +105,7 @@ public final class CloseStatus {
*/
public static final CloseStatus REQUIRED_EXTENSION = new CloseStatus(1010);
/**
/**
* "1011 indicates that a server is terminating the connection because it encountered
* an unexpected condition that prevented it from fulfilling the request."
*/
@ -125,7 +124,7 @@ public final class CloseStatus { @@ -125,7 +124,7 @@ public final class CloseStatus {
*/
public static final CloseStatus SERVICE_OVERLOAD = new CloseStatus(1013);
/**
/**
* "1015 is a reserved value and MUST NOT be set as a status code in a Close control
* frame by an endpoint. It is designated for use in applications expecting a status
* code to indicate that the connection was closed due to a failure to perform a TLS
@ -134,32 +133,51 @@ public final class CloseStatus { @@ -134,32 +133,51 @@ public final class CloseStatus {
public static final CloseStatus TLS_HANDSHAKE_FAILURE = new CloseStatus(1015);
private final int code;
private final String reason;
/**
* Create a new {@link CloseStatus} instance.
* @param code the status code
*/
public CloseStatus(int code) {
this(code, null);
}
/**
* Create a new {@link CloseStatus} instance.
* @param code
* @param reason
*/
public CloseStatus(int code, String reason) {
Assert.isTrue((code >= 1000 && code < 5000), "Invalid code");
this.code = code;
this.reason = reason;
}
/**
* Returns the status code.
*/
public int getCode() {
return this.code;
}
/**
* Returns the reason or {@code null}.
*/
public String getReason() {
return this.reason;
}
/**
* Crate a new {@link CloseStatus} from this one with the specified reason.
* @param reason the reason
* @return a new {@link StatusCode} instance
*/
public CloseStatus withReason(String reason) {
Assert.hasText(reason, "Expected non-empty reason");
Assert.hasText(reason, "Reason must not be empty");
return new CloseStatus(this.code, reason);
}

2
spring-websocket/src/main/java/org/springframework/websocket/HandlerProvider.java

@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket;
package org.springframework.websocket;
/**
* A strategy for obtaining a handler instance that is scoped to external lifecycle events

2
spring-websocket/src/main/java/org/springframework/websocket/PartialMessageHandler.java

@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket;
package org.springframework.websocket;
/**
* A "marker" interface for {@link BinaryMessageHandler} types that wish to handle partial

14
spring-websocket/src/main/java/org/springframework/websocket/TextMessage.java

@ -13,23 +13,31 @@ @@ -13,23 +13,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket;
import java.io.Reader;
import java.io.StringReader;
/**
* Represents a text WebSocket message.
* A {@link WebSocketMessage} that contains a textual {@link String} payload.
*
* @author Rossen Stoyanchev
* @since 4.0
*/
public final class TextMessage extends WebSocketMessage<String> {
public TextMessage(String payload) {
super(payload);
/**
* Create a new {@link TextMessage} instance.
* @param payload the payload
*/
public TextMessage(CharSequence payload) {
super(payload.toString());
}
/**
* Returns access to the message payload as a {@link Reader}.
*/
public Reader getReader() {
return new StringReader(getPayload());
}

2
spring-websocket/src/main/java/org/springframework/websocket/WebSocketHandler.java

@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
package org.springframework.websocket;
/**
* A handler for WebSocket sessions.
*

1
spring-websocket/src/main/java/org/springframework/websocket/WebSocketHandlerAdapter.java

@ -22,6 +22,7 @@ package org.springframework.websocket; @@ -22,6 +22,7 @@ package org.springframework.websocket;
*
* @author Rossen Stoyanchev
* @since 4.0
* @see WebSocketHandler
*/
public class WebSocketHandlerAdapter implements WebSocketHandler {

15
spring-websocket/src/main/java/org/springframework/websocket/WebSocketMessage.java

@ -13,27 +13,40 @@ @@ -13,27 +13,40 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* A message that can be sent or received over a WebSocket connection. A WebSocket
* message must be either a {@link BinaryMessage} or a {@link TextMessage} depending
* on the payload. No further subclasses are supported.
*
* @author Rossen Stoyanchev
* @since 4.0
* @see BinaryMessage
* @see TextMessage
*/
public abstract class WebSocketMessage<T> {
private final T payload;
/**
* Create a new {@link WebSocketMessage} instance.
* @param payload a non-null payload
*/
WebSocketMessage(T payload) {
Assert.notNull(payload, "Payload must not be null");
this.payload = payload;
}
/**
* Returns the message payload. This will never be {@code null}.
*/
public T getPayload() {
return this.payload;
}

1
spring-websocket/src/main/java/org/springframework/websocket/WebSocketSession.java

@ -19,7 +19,6 @@ package org.springframework.websocket; @@ -19,7 +19,6 @@ package org.springframework.websocket;
import java.io.IOException;
import java.net.URI;
/**
* Allows sending messages over a WebSocket connection as well as closing it.
*

4
spring-websocket/src/main/java/org/springframework/websocket/client/AbstractWebSocketConnectionManager.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket.client;
import java.net.URI;
@ -24,8 +25,8 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor; @@ -24,8 +25,8 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.core.task.TaskExecutor;
import org.springframework.web.util.UriComponentsBuilder;
/**
* Abstract base class for WebSocketConnection managers.
*
* @author Rossen Stoyanchev
* @since 4.0
@ -34,6 +35,7 @@ public abstract class AbstractWebSocketConnectionManager implements SmartLifecyc @@ -34,6 +35,7 @@ public abstract class AbstractWebSocketConnectionManager implements SmartLifecyc
protected final Log logger = LogFactory.getLog(getClass());
private final URI uri;
private boolean autoStartup = false;

2
spring-websocket/src/main/java/org/springframework/websocket/client/WebSocketClient.java

@ -22,7 +22,6 @@ import org.springframework.websocket.HandlerProvider; @@ -22,7 +22,6 @@ import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
import org.springframework.websocket.WebSocketSession;
/**
* Contract for starting a WebSocket handshake request.
*
@ -36,7 +35,6 @@ import org.springframework.websocket.WebSocketSession; @@ -36,7 +35,6 @@ import org.springframework.websocket.WebSocketSession;
*/
public interface WebSocketClient {
WebSocketSession doHandshake(WebSocketHandler handler,
String uriTemplate, Object... uriVariables) throws WebSocketConnectFailureException;

4
spring-websocket/src/main/java/org/springframework/websocket/client/WebSocketConnectFailureException.java

@ -13,20 +13,18 @@ @@ -13,20 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket.client;
import org.springframework.core.NestedRuntimeException;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/
@SuppressWarnings("serial")
public class WebSocketConnectFailureException extends NestedRuntimeException {
public WebSocketConnectFailureException(String msg, Throwable cause) {
super(msg, cause);
}

4
spring-websocket/src/main/java/org/springframework/websocket/client/WebSocketConnectionManager.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket.client;
import java.util.ArrayList;
@ -25,9 +26,7 @@ import org.springframework.websocket.WebSocketHandler; @@ -25,9 +26,7 @@ import org.springframework.websocket.WebSocketHandler;
import org.springframework.websocket.WebSocketSession;
import org.springframework.websocket.support.SimpleHandlerProvider;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/
@ -58,6 +57,7 @@ public class WebSocketConnectionManager extends AbstractWebSocketConnectionManag @@ -58,6 +57,7 @@ public class WebSocketConnectionManager extends AbstractWebSocketConnectionManag
this.handlerProvider = handlerProvider;
}
public void setSubProtocols(List<String> subProtocols) {
this.subProtocols.clear();
if (!CollectionUtils.isEmpty(subProtocols)) {

3
spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/AnnotatedEndpointConnectionManager.java

@ -25,9 +25,7 @@ import org.springframework.websocket.HandlerProvider; @@ -25,9 +25,7 @@ import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.support.BeanCreatingHandlerProvider;
import org.springframework.websocket.support.SimpleHandlerProvider;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/
@ -47,6 +45,7 @@ public class AnnotatedEndpointConnectionManager extends EndpointConnectionManage @@ -47,6 +45,7 @@ public class AnnotatedEndpointConnectionManager extends EndpointConnectionManage
this.handlerProvider = new BeanCreatingHandlerProvider<Object>(endpointClass);
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
if (this.handlerProvider instanceof BeanFactoryAware) {

3
spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/EndpointConnectionManager.java

@ -35,9 +35,7 @@ import org.springframework.websocket.HandlerProvider; @@ -35,9 +35,7 @@ import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.support.BeanCreatingHandlerProvider;
import org.springframework.websocket.support.SimpleHandlerProvider;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/
@ -60,6 +58,7 @@ public class EndpointConnectionManager extends EndpointConnectionManagerSupport @@ -60,6 +58,7 @@ public class EndpointConnectionManager extends EndpointConnectionManagerSupport
this.handlerProvider = new BeanCreatingHandlerProvider<Endpoint>(endpointClass);
}
public void setSubProtocols(String... subprotocols) {
this.configBuilder.preferredSubprotocols(Arrays.asList(subprotocols));
}

3
spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/EndpointConnectionManagerSupport.java

@ -22,9 +22,7 @@ import javax.websocket.WebSocketContainer; @@ -22,9 +22,7 @@ import javax.websocket.WebSocketContainer;
import org.springframework.websocket.client.AbstractWebSocketConnectionManager;
/**
*
* @author Rossen Stoyanchev
* @since 4.0
*/
@ -39,6 +37,7 @@ public abstract class EndpointConnectionManagerSupport extends AbstractWebSocket @@ -39,6 +37,7 @@ public abstract class EndpointConnectionManagerSupport extends AbstractWebSocket
super(uriTemplate, uriVariables);
}
public void setWebSocketContainer(WebSocketContainer webSocketContainer) {
this.webSocketContainer = webSocketContainer;
}

2
spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/StandardWebSocketClient.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket.client.endpoint;
import java.net.URI;
@ -40,7 +41,6 @@ import org.springframework.websocket.endpoint.StandardWebSocketSession; @@ -40,7 +41,6 @@ import org.springframework.websocket.endpoint.StandardWebSocketSession;
import org.springframework.websocket.endpoint.WebSocketHandlerEndpoint;
import org.springframework.websocket.support.SimpleHandlerProvider;
/**
* A standard Java {@link WebSocketClient}.
*

2
spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/WebSocketContainerFactoryBean.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket.client.endpoint;
import javax.websocket.ContainerProvider;
@ -20,7 +21,6 @@ import javax.websocket.WebSocketContainer; @@ -20,7 +21,6 @@ import javax.websocket.WebSocketContainer;
import org.springframework.beans.factory.FactoryBean;
/**
* A FactoryBean for creating and configuring a {@link javax.websocket.WebSocketContainer}
* through Spring XML configuration. In Java configuration, ignore this class and use

16
spring-websocket/src/main/java/org/springframework/websocket/client/endpoint/package-info.java

@ -1,3 +1,19 @@ @@ -1,3 +1,19 @@
/*
* 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.
*/
/**
* Client-side classes for use with standard Java WebSocket endpoints including
* {@link org.springframework.websocket.client.endpoint.EndpointConnectionManager} and

17
spring-websocket/src/main/java/org/springframework/websocket/client/package-info.java

@ -1,6 +1,21 @@ @@ -1,6 +1,21 @@
/*
* 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-side abstractions for WebSocket applications.
*
*/
package org.springframework.websocket.client;

2
spring-websocket/src/main/java/org/springframework/websocket/endpoint/StandardWebSocketSession.java

@ -32,7 +32,6 @@ import org.springframework.websocket.TextMessage; @@ -32,7 +32,6 @@ import org.springframework.websocket.TextMessage;
import org.springframework.websocket.WebSocketMessage;
import org.springframework.websocket.WebSocketSession;
/**
* A standard Java implementation of {@link WebSocketSession} that delegates to
* {@link javax.websocket.Session}.
@ -52,6 +51,7 @@ public class StandardWebSocketSession implements WebSocketSession { @@ -52,6 +51,7 @@ public class StandardWebSocketSession implements WebSocketSession {
this.session = session;
}
@Override
public String getId() {
return this.session.getId();

1
spring-websocket/src/main/java/org/springframework/websocket/endpoint/WebSocketHandlerEndpoint.java

@ -59,6 +59,7 @@ public class WebSocketHandlerEndpoint extends Endpoint { @@ -59,6 +59,7 @@ public class WebSocketHandlerEndpoint extends Endpoint {
this.handlerProvider = handlerProvider;
}
@Override
public void onOpen(final javax.websocket.Session session, EndpointConfig config) {

16
spring-websocket/src/main/java/org/springframework/websocket/endpoint/package-info.java

@ -1,8 +1,22 @@ @@ -1,8 +1,22 @@
/*
* 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.
*/
/**
* Classes for use with the standard Java WebSocket endpoints from both client and
* server code.
*
*/
package org.springframework.websocket.endpoint;

16
spring-websocket/src/main/java/org/springframework/websocket/package-info.java

@ -1,7 +1,21 @@ @@ -1,7 +1,21 @@
/*
* 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.
*/
/**
* Common abstractions and Spring configuration support for WebSocket applications.
*
*/
package org.springframework.websocket;

2
spring-websocket/src/main/java/org/springframework/websocket/server/DefaultHandshakeHandler.java

@ -38,7 +38,6 @@ import org.springframework.util.StringUtils; @@ -38,7 +38,6 @@ import org.springframework.util.StringUtils;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
/**
* TODO
* <p>
@ -78,6 +77,7 @@ public class DefaultHandshakeHandler implements HandshakeHandler { @@ -78,6 +77,7 @@ public class DefaultHandshakeHandler implements HandshakeHandler {
this.requestUpgradeStrategy = upgradeStrategy;
}
public void setSupportedProtocols(String... protocols) {
this.supportedProtocols = Arrays.asList(protocols);
}

1
spring-websocket/src/main/java/org/springframework/websocket/server/HandshakeHandler.java

@ -23,7 +23,6 @@ import org.springframework.http.server.ServerHttpResponse; @@ -23,7 +23,6 @@ import org.springframework.http.server.ServerHttpResponse;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
/**
* Contract for processing a WebSocket handshake request.
*

1
spring-websocket/src/main/java/org/springframework/websocket/server/RequestUpgradeStrategy.java

@ -23,7 +23,6 @@ import org.springframework.http.server.ServerHttpResponse; @@ -23,7 +23,6 @@ import org.springframework.http.server.ServerHttpResponse;
import org.springframework.websocket.HandlerProvider;
import org.springframework.websocket.WebSocketHandler;
/**
* A strategy for performing container-specific steps to upgrade an HTTP request during a
* WebSocket handshake. Intended for use within {@link HandshakeHandler} implementations.

1
spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/EndpointExporter.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket.server.endpoint;
import java.lang.reflect.Method;

1
spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/EndpointRegistration.java

@ -94,6 +94,7 @@ public class EndpointRegistration implements ServerEndpointConfig, BeanFactoryAw @@ -94,6 +94,7 @@ public class EndpointRegistration implements ServerEndpointConfig, BeanFactoryAw
this.handlerProvider = new SimpleHandlerProvider<Endpoint>(endpointBean);
}
@Override
public String getPath() {
return this.path;

4
spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/ServletServerContainerFactoryBean.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket.server.endpoint;
import javax.servlet.ServletContext;
@ -26,7 +27,6 @@ import org.springframework.util.Assert; @@ -26,7 +27,6 @@ import org.springframework.util.Assert;
import org.springframework.web.context.ServletContextAware;
import org.springframework.websocket.server.DefaultHandshakeHandler;
/**
* A FactoryBean for {@link javax.websocket.server.ServerContainer}. Since
* there is only one {@code ServerContainer} instance accessible under a well-known
@ -46,6 +46,7 @@ public class ServletServerContainerFactoryBean @@ -46,6 +46,7 @@ public class ServletServerContainerFactoryBean
private static final String SERVER_CONTAINER_ATTR_NAME = "javax.websocket.server.ServerContainer";
private Long asyncSendTimeout;
private Long maxSessionIdleTimeout;
@ -54,7 +55,6 @@ public class ServletServerContainerFactoryBean @@ -54,7 +55,6 @@ public class ServletServerContainerFactoryBean
private Integer maxBinaryMessageBufferSize;
private ServerContainer serverContainer;

1
spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/SpringConfigurator.java

@ -26,7 +26,6 @@ import org.apache.commons.logging.LogFactory; @@ -26,7 +26,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;
/**
* This should be used in conjuction with {@link ServerEndpoint @ServerEndpoint} classes.
*

15
spring-websocket/src/main/java/org/springframework/websocket/server/endpoint/package-info.java

@ -1,3 +1,18 @@ @@ -1,3 +1,18 @@
/*
* 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 including

16
spring-websocket/src/main/java/org/springframework/websocket/server/package-info.java

@ -1,7 +1,21 @@ @@ -1,7 +1,21 @@
/*
* 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-side abstractions for WebSocket applications.
*
*/
package org.springframework.websocket.server;

1
spring-websocket/src/main/java/org/springframework/websocket/server/support/AbstractEndpointUpgradeStrategy.java

@ -29,7 +29,6 @@ import org.springframework.websocket.WebSocketHandler; @@ -29,7 +29,6 @@ import org.springframework.websocket.WebSocketHandler;
import org.springframework.websocket.endpoint.WebSocketHandlerEndpoint;
import org.springframework.websocket.server.RequestUpgradeStrategy;
/**
* A {@link RequestUpgradeStrategy} that supports WebSocket handlers of type
* {@link WebSocketHandler} as well as {@link javax.websocket.Endpoint}.

1
spring-websocket/src/main/java/org/springframework/websocket/server/support/JettyRequestUpgradeStrategy.java

@ -92,6 +92,7 @@ public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy { @@ -92,6 +92,7 @@ public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy {
}
}
@Override
public String[] getSupportedVersions() {
return new String[] { String.valueOf(HandshakeRFC6455.VERSION) };

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

@ -34,7 +34,6 @@ import org.springframework.util.Assert; @@ -34,7 +34,6 @@ import org.springframework.util.Assert;
import org.springframework.util.ReflectionUtils;
import org.springframework.websocket.server.endpoint.EndpointRegistration;
/**
* Tomcat support for upgrading an {@link HttpServletRequest} during a WebSocket handshake.
*
@ -43,7 +42,6 @@ import org.springframework.websocket.server.endpoint.EndpointRegistration; @@ -43,7 +42,6 @@ import org.springframework.websocket.server.endpoint.EndpointRegistration;
*/
public class TomcatRequestUpgradeStrategy extends AbstractEndpointUpgradeStrategy {
@Override
public String[] getSupportedVersions() {
return new String[] { "13" };

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

@ -35,7 +35,6 @@ import org.springframework.websocket.server.DefaultHandshakeHandler; @@ -35,7 +35,6 @@ import org.springframework.websocket.server.DefaultHandshakeHandler;
import org.springframework.websocket.server.HandshakeHandler;
import org.springframework.websocket.support.SimpleHandlerProvider;
/**
* An {@link HttpRequestHandler} that wraps the invocation of a {@link HandshakeHandler}.
*
@ -59,7 +58,6 @@ public class WebSocketHttpRequestHandler implements HttpRequestHandler { @@ -59,7 +58,6 @@ public class WebSocketHttpRequestHandler implements HttpRequestHandler {
public WebSocketHttpRequestHandler( HandlerProvider<WebSocketHandler> handlerProvider,
HandshakeHandler handshakeHandler) {
Assert.notNull(handlerProvider, "handlerProvider is required");
Assert.notNull(handshakeHandler, "handshakeHandler is required");
this.handlerProvider = handlerProvider;

19
spring-websocket/src/main/java/org/springframework/websocket/server/support/package-info.java

@ -1,7 +1,22 @@ @@ -1,7 +1,22 @@
/*
* 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-side support classes including container-specific strategies for upgrading a request.
*
* Server-side support classes including container-specific strategies for upgrading a
* request.
*/
package org.springframework.websocket.server.support;

2
spring-websocket/src/main/java/org/springframework/websocket/support/BeanCreatingHandlerProvider.java

@ -26,7 +26,6 @@ import org.springframework.beans.factory.config.AutowireCapableBeanFactory; @@ -26,7 +26,6 @@ import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.util.Assert;
import org.springframework.websocket.HandlerProvider;
/**
* A {@link HandlerProvider} that uses {@link AutowireCapableBeanFactory#createBean(Class)
* creating a fresh instance every time #getHandler() is called.
@ -48,6 +47,7 @@ public class BeanCreatingHandlerProvider<T> implements HandlerProvider<T>, BeanF @@ -48,6 +47,7 @@ public class BeanCreatingHandlerProvider<T> implements HandlerProvider<T>, BeanF
this.handlerClass = handlerClass;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
if (beanFactory instanceof AutowireCapableBeanFactory) {

3
spring-websocket/src/main/java/org/springframework/websocket/support/SimpleHandlerProvider.java

@ -13,12 +13,12 @@ @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.websocket.support;
import org.springframework.util.ClassUtils;
import org.springframework.websocket.HandlerProvider;
/**
* A {@link HandlerProvider} that returns a singleton instance.
*
@ -34,6 +34,7 @@ public class SimpleHandlerProvider<T> implements HandlerProvider<T> { @@ -34,6 +34,7 @@ public class SimpleHandlerProvider<T> implements HandlerProvider<T> {
this.handler = handler;
}
@Override
public boolean isSingleton() {
return true;

Loading…
Cancel
Save