General polish of new 4.0 classes

Apply consistent styling to new classes introduced in Spring 4.0.

- Javadoc line wrapping, whitespace and formatting
- General code whitespace
- Consistent Assert.notNull messages
This commit is contained in:
Phillip Webb
2013-11-26 14:47:39 -08:00
parent 690051f46c
commit 15698860e1
190 changed files with 350 additions and 695 deletions

View File

@@ -34,7 +34,6 @@ public abstract class AbstractWebSocketMessage<T> implements WebSocketMessage<T>
/**
* Create a new WebSocket message with the given payload.
*
* @param payload the non-null payload
*/
AbstractWebSocketMessage(T payload) {
@@ -46,12 +45,11 @@ public abstract class AbstractWebSocketMessage<T> implements WebSocketMessage<T>
* message content. When the {@code isLast} boolean flag is set to {@code false}
* the message is sent as partial content and more partial messages will be
* expected until the boolean flag is set to {@code true}.
*
* @param payload the non-null payload
* @param isLast if the message is the last of a series of partial messages
*/
AbstractWebSocketMessage(T payload, boolean isLast) {
Assert.notNull(payload, "payload is required");
Assert.notNull(payload, "payload must not be null");
this.payload = payload;
this.last = isLast;
}

View File

@@ -29,7 +29,6 @@ public final class BinaryMessage extends AbstractWebSocketMessage<ByteBuffer> {
/**
* Create a new binary WebSocket message with the given ByteBuffer payload.
*
* @param payload the non-null payload
*/
public BinaryMessage(ByteBuffer payload) {
@@ -41,7 +40,6 @@ public final class BinaryMessage extends AbstractWebSocketMessage<ByteBuffer> {
* full or partial message content. When the {@code isLast} boolean flag is set
* to {@code false} the message is sent as partial content and more partial
* messages will be expected until the boolean flag is set to {@code true}.
*
* @param payload the non-null payload
* @param isLast if the message is the last of a series of partial messages
*/
@@ -51,9 +49,8 @@ public final class BinaryMessage extends AbstractWebSocketMessage<ByteBuffer> {
/**
* Create a new binary WebSocket message with the given byte[] payload.
*
* @param payload a non-null payload; note that this value is not copied so care
* must be taken not to modify the array.
* must be taken not to modify the array.
*/
public BinaryMessage(byte[] payload) {
this(payload, true);
@@ -64,9 +61,8 @@ public final class BinaryMessage extends AbstractWebSocketMessage<ByteBuffer> {
* the full or partial message content. When the {@code isLast} boolean flag is set
* to {@code false} the message is sent as partial content and more partial
* messages will be expected until the boolean flag is set to {@code true}.
*
* @param payload a non-null payload; note that this value is not copied so care
* must be taken not to modify the array.
* 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, boolean isLast) {
@@ -75,9 +71,8 @@ public final class BinaryMessage extends AbstractWebSocketMessage<ByteBuffer> {
/**
* Create a new binary WebSocket message by wrapping an existing byte array.
*
* @param payload a non-null payload; note that this value is not copied so care
* must be taken not to modify the array.
* must be taken not to modify the array.
* @param offset the offset into the array where the payload starts
* @param length the length of the array considered for the payload
* @param isLast if the message is the last of a series of partial messages

View File

@@ -36,7 +36,6 @@ public final class PingMessage extends AbstractWebSocketMessage<ByteBuffer> {
/**
* Create a new ping message with the given ByteBuffer payload.
*
* @param payload the non-null payload
*/
public PingMessage(ByteBuffer payload) {

View File

@@ -36,7 +36,6 @@ public final class PongMessage extends AbstractWebSocketMessage<ByteBuffer> {
/**
* Create a new pong message with the given ByteBuffer payload.
*
* @param payload the non-null payload
*/
public PongMessage(ByteBuffer payload) {

View File

@@ -27,7 +27,6 @@ public final class TextMessage extends AbstractWebSocketMessage<String> {
/**
* Create a new text WebSocket message from the given CharSequence payload.
*
* @param payload the non-null payload
*/
public TextMessage(CharSequence payload) {
@@ -39,7 +38,6 @@ public final class TextMessage extends AbstractWebSocketMessage<String> {
* full or partial message content. When the {@code isLast} boolean flag is set
* to {@code false} the message is sent as partial content and more partial
* messages will be expected until the boolean flag is set to {@code true}.
*
* @param payload the non-null payload
* @param isLast whether this the last part of a series of partial messages
*/

View File

@@ -18,8 +18,8 @@ package org.springframework.web.socket;
/**
* A handler for WebSocket messages and lifecycle events.
* <p>
* Implementations of this interface are encouraged to handle exceptions locally where
*
* <p>Implementations of this interface are encouraged to handle exceptions locally where
* it makes sense or alternatively let the exception bubble up in which case by default
* the exception is logged and the session closed with
* {@link CloseStatus#SERVER_ERROR SERVER_ERROR(1011)}. The exception handling
@@ -38,21 +38,21 @@ public interface WebSocketHandler {
* Invoked after WebSocket negotiation has succeeded and the WebSocket connection is
* opened and ready for use.
* @throws Exception this method can handle or propagate exceptions; see class-level
* Javadoc for details.
* Javadoc for details.
*/
void afterConnectionEstablished(WebSocketSession session) throws Exception;
/**
* Invoked when a new WebSocket message arrives.
* @throws Exception this method can handle or propagate exceptions; see class-level
* Javadoc for details.
* Javadoc for details.
*/
void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception;
/**
* Handle an error from the underlying WebSocket message transport.
* @throws Exception this method can handle or propagate exceptions; see class-level
* Javadoc for details.
* Javadoc for details.
*/
void handleTransportError(WebSocketSession session, Throwable exception) throws Exception;
@@ -61,9 +61,8 @@ public interface WebSocketHandler {
* transport error has occurred. Although the session may technically still be open,
* depending on the underlying implementation, sending messages at this point is
* discouraged and most likely will not succeed.
*
* @throws Exception this method can handle or propagate exceptions; see class-level
* Javadoc for details.
* Javadoc for details.
*/
void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception;

View File

@@ -46,9 +46,8 @@ public abstract class AbstractWebSocketSesssion<T> implements WebSocketSession,
/**
* Class constructor
*
* @param handshakeAttributes attributes from the HTTP handshake to make available
* through the WebSocket session
* through the WebSocket session
*/
public AbstractWebSocketSesssion(Map<String, Object> handshakeAttributes) {
this.handshakeAttributes = handshakeAttributes;

View File

@@ -52,8 +52,7 @@ public class JettyWebSocketSession extends AbstractWebSocketSesssion<org.eclipse
/**
* Class constructor.
*
* Create a new {@link JettyWebSocketSession} instance.
* @param principal the user associated with the session, or {@code null}
* @param handshakeAttributes attributes from the HTTP handshake to make available
* through the WebSocket session

View File

@@ -18,7 +18,6 @@ package org.springframework.web.socket.adapter;
import org.springframework.web.socket.WebSocketSession;
/**
* A {@link WebSocketSession} that exposes the underlying, native WebSocketSession
* through a getter.
@@ -28,7 +27,6 @@ import org.springframework.web.socket.WebSocketSession;
*/
public interface NativeWebSocketSession extends WebSocketSession {
/**
* Return the underlying native WebSocketSession, if available.
* @return the native session or {@code null}

View File

@@ -57,16 +57,14 @@ public class StandardWebSocketSession extends AbstractWebSocketSesssion<javax.we
/**
* Class constructor.
*
* @param headers the headers of the handshake request
* @param handshakeAttributes attributes from the HTTP handshake to make available
* through the WebSocket session
* through the WebSocket session
* @param localAddress the address on which the request was received
* @param remoteAddress the address of the remote client
*/
public StandardWebSocketSession(HttpHeaders headers, Map<String, Object> handshakeAttributes,
InetSocketAddress localAddress, InetSocketAddress remoteAddress) {
super(handshakeAttributes);
headers = (headers != null) ? headers : new HttpHeaders();
this.handshakeHeaders = HttpHeaders.readOnlyHttpHeaders(headers);

View File

@@ -39,7 +39,7 @@ public class TextWebSocketHandlerAdapter extends WebSocketHandlerAdapter {
try {
session.close(CloseStatus.NOT_ACCEPTABLE.withReason("Binary messages not supported"));
}
catch (IOException e) {
catch (IOException ex) {
// ignore
}
}

View File

@@ -34,7 +34,6 @@ import org.springframework.web.socket.support.WebSocketExtension;
import org.springframework.web.socket.support.WebSocketHttpHeaders;
import org.springframework.web.util.UriComponentsBuilder;
/**
* Abstract base class for {@link WebSocketClient} implementations.
*
@@ -105,16 +104,14 @@ public abstract class AbstractWebSocketClient implements WebSocketClient {
/**
* Perform the actual handshake to establish a connection to the server.
*
* @param webSocketHandler the client-side handler for WebSocket messages
* @param headers HTTP headers to use for the handshake, with unwanted (forbidden)
* headers filtered out, never {@code null}
* headers filtered out, never {@code null}
* @param uri the target URI for the handshake, never {@code null}
* @param subProtocols requested sub-protocols, or an empty list
* @param extensions requested WebSocket extensions, or an empty list
* @param handshakeAttributes attributes to make available via
* {@link WebSocketSession#getHandshakeAttributes()}; currently always an empty map.
*
* {@link WebSocketSession#getHandshakeAttributes()}; currently always an empty map.
* @return the established WebSocket session wrapped in a ListenableFuture.
*/
protected abstract ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandler webSocketHandler,

View File

@@ -58,7 +58,6 @@ public abstract class ConnectionManagerSupport implements SmartLifecycle {
/**
* Set whether to auto-connect to the remote endpoint after this connection manager
* has been initialized and the Spring context has been refreshed.
*
* <p>Default is "false".
*/
public void setAutoStartup(boolean autoStartup) {

View File

@@ -30,7 +30,6 @@ import org.springframework.web.socket.support.WebSocketHttpHeaders;
*
* @author Rossen Stoyanchev
* @since 4.0
*
* @see WebSocketConnectionManager
*/
public interface WebSocketClient {

View File

@@ -61,7 +61,6 @@ public class WebSocketConnectionManager extends ConnectionManagerSupport {
/**
* Decorate the WebSocketHandler provided to the class constructor.
*
* <p>By default {@link LoggingWebSocketHandlerDecorator} is added.
*/
protected WebSocketHandler decorateWebSocketHandler(WebSocketHandler handler) {

View File

@@ -85,7 +85,7 @@ public class AnnotatedEndpointConnectionManager extends ConnectionManagerSupport
* By default {@link SimpleAsyncTaskExecutor} is used.
*/
public void setTaskExecutor(TaskExecutor taskExecutor) {
Assert.notNull(taskExecutor, "taskExecutor is required");
Assert.notNull(taskExecutor, "TaskExecutor must not be null");
this.taskExecutor = taskExecutor;
}

View File

@@ -118,7 +118,7 @@ public class EndpointConnectionManager extends ConnectionManagerSupport implemen
* By default {@link SimpleAsyncTaskExecutor} is used.
*/
public void setTaskExecutor(TaskExecutor taskExecutor) {
Assert.notNull(taskExecutor, "taskExecutor is required");
Assert.notNull(taskExecutor, "TaskExecutor must not be null");
this.taskExecutor = taskExecutor;
}

View File

@@ -76,12 +76,13 @@ public class StandardWebSocketClient extends AbstractWebSocketClient {
this.webSocketContainer = webSocketContainer;
}
/**
* Set a {@link TaskExecutor} to use to open the connection.
* By default {@link SimpleAsyncTaskExecutor} is used.
*/
public void setTaskExecutor(AsyncListenableTaskExecutor taskExecutor) {
Assert.notNull(taskExecutor, "taskExecutor is required");
Assert.notNull(taskExecutor, "TaskExecutor must not be null");
this.taskExecutor = taskExecutor;
}

View File

@@ -84,7 +84,7 @@ public class JettyWebSocketClient extends AbstractWebSocketClient implements Sma
* By default {@link SimpleAsyncTaskExecutor} is used.
*/
public void setTaskExecutor(AsyncListenableTaskExecutor taskExecutor) {
Assert.notNull(taskExecutor, "taskExecutor is required");
Assert.notNull(taskExecutor, "TaskExecutor must not be null");
this.taskExecutor = taskExecutor;
}
@@ -200,7 +200,7 @@ public class JettyWebSocketClient extends AbstractWebSocketClient implements Sma
/**
* @return the user to make available through {@link WebSocketSession#getPrincipal()};
* by default this method returns {@code null}
* by default this method returns {@code null}
*/
protected Principal getUser() {
return null;

View File

@@ -24,7 +24,6 @@ import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketMessage;
import org.springframework.web.socket.WebSocketSession;
/**
* A contract for handling WebSocket messages as part of a higher level protocol, referred
* to as "sub-protocol" in the WebSocket RFC specification. Handles both
@@ -49,7 +48,6 @@ public interface SubProtocolHandler {
/**
* Handle the given {@link WebSocketMessage} received from a client.
*
* @param session the client session
* @param message the client message
* @param outputChannel an output channel to send messages to
@@ -60,7 +58,6 @@ public interface SubProtocolHandler {
/**
* Handle the given {@link Message} to the client associated with the given WebSocket
* session.
*
* @param session the client session
* @param message the client message
*/
@@ -68,14 +65,12 @@ public interface SubProtocolHandler {
/**
* Resolve the session id from the given message or return {@code null}.
*
* @param message the message to resolve the session id from
*/
String resolveSessionId(Message<?> message);
/**
* Invoked after a {@link WebSocketSession} has started.
*
* @param session the client session
* @param outputChannel a channel
*/
@@ -83,7 +78,6 @@ public interface SubProtocolHandler {
/**
* Invoked after a {@link WebSocketSession} has ended.
*
* @param session the client session
* @param closeStatus the reason why the session was closed
* @param outputChannel a channel

View File

@@ -34,7 +34,6 @@ import org.springframework.web.socket.WebSocketMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.support.SubProtocolCapable;
/**
* An implementation of {@link WebSocketHandler} that delegates incoming WebSocket
* messages to a {@link SubProtocolHandler} along with a {@link MessageChannel} to
@@ -66,7 +65,7 @@ public class SubProtocolWebSocketHandler implements SubProtocolCapable, WebSocke
public SubProtocolWebSocketHandler(MessageChannel clientOutboundChannel) {
Assert.notNull(clientOutboundChannel, "clientOutboundChannel is required");
Assert.notNull(clientOutboundChannel, "ClientOutboundChannel must not be null");
this.clientOutboundChannel = clientOutboundChannel;
}
@@ -74,7 +73,6 @@ public class SubProtocolWebSocketHandler implements SubProtocolCapable, WebSocke
/**
* Configure one or more handlers to use depending on the sub-protocol requested by
* the client in the WebSocket handshake request.
*
* @param protocolHandlers the sub-protocol handlers to use
*/
public void setProtocolHandlers(List<SubProtocolHandler> protocolHandlers) {
@@ -112,7 +110,6 @@ public class SubProtocolWebSocketHandler implements SubProtocolCapable, WebSocke
/**
* Set the {@link SubProtocolHandler} to use when the client did not request a
* sub-protocol.
*
* @param defaultProtocolHandler the default handler
*/
public void setDefaultProtocolHandler(SubProtocolHandler defaultProtocolHandler) {

View File

@@ -25,7 +25,6 @@ import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.util.CollectionUtils;
/**
* A {@link WebSocketMessageBrokerConfigurationSupport} extension that detects beans of type
* {@link WebSocketMessageBrokerConfigurer}

View File

@@ -20,7 +20,6 @@ import java.lang.annotation.Target;
import org.springframework.context.annotation.Import;
/**
* Add this annotation to an {@code @Configuration} class to enable broker-backed
* messaging over WebSocket using a higher-level messaging sub-protocol.

View File

@@ -30,7 +30,6 @@ import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
import org.springframework.web.socket.support.WebSocketHandlerDecorator;
/**
* A registry for STOMP over WebSocket endpoints that maps the endpoints with a
* {@link SimpleUrlHandlerMapping} for use in Spring MVC.
@@ -56,10 +55,8 @@ public class WebMvcStompEndpointRegistry implements StompEndpointRegistry {
public WebMvcStompEndpointRegistry(WebSocketHandler webSocketHandler,
UserSessionRegistry userSessionRegistry, TaskScheduler defaultSockJsTaskScheduler) {
Assert.notNull(webSocketHandler);
Assert.notNull(userSessionRegistry);
this.webSocketHandler = webSocketHandler;
this.subProtocolWebSocketHandler = unwrapSubProtocolWebSocketHandler(webSocketHandler);
this.stompHandler = new StompSubProtocolHandler();
@@ -68,34 +65,27 @@ public class WebMvcStompEndpointRegistry implements StompEndpointRegistry {
}
private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler webSocketHandler) {
WebSocketHandler actual = (webSocketHandler instanceof WebSocketHandlerDecorator) ?
((WebSocketHandlerDecorator) webSocketHandler).getLastHandler() : webSocketHandler;
Assert.isInstanceOf(SubProtocolWebSocketHandler.class, actual,
"No SubProtocolWebSocketHandler found: " + webSocketHandler);
return (SubProtocolWebSocketHandler) actual;
}
@Override
public StompWebSocketEndpointRegistration addEndpoint(String... paths) {
this.subProtocolWebSocketHandler.addProtocolHandler(this.stompHandler);
WebMvcStompWebSocketEndpointRegistration registration = new WebMvcStompWebSocketEndpointRegistration(
paths, this.webSocketHandler, this.sockJsScheduler);
this.registrations.add(registration);
return registration;
}
/**
* Set the order for the resulting {@link SimpleUrlHandlerMapping} relative to
* other handler mappings configured in Spring MVC.
* <p>
* The default value is 1.
* <p>The default value is 1.
*/
public void setOrder(int order) {
this.order = order;

View File

@@ -16,16 +16,12 @@
package org.springframework.web.socket.messaging.config;
import java.util.Set;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.ObjectUtils;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.DefaultHandshakeHandler;
import org.springframework.web.socket.server.HandshakeHandler;
import org.springframework.web.socket.server.config.SockJsServiceRegistration;
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
@@ -33,7 +29,6 @@ import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsService;
import org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler;
/**
* An abstract base class class for configuring STOMP over WebSocket/SockJS endpoints.
*
@@ -57,7 +52,7 @@ public class WebMvcStompWebSocketEndpointRegistration implements StompWebSocketE
TaskScheduler sockJsTaskScheduler) {
Assert.notEmpty(paths, "No paths specified");
Assert.notNull(webSocketHandler, "'webSocketHandler' is required");
Assert.notNull(webSocketHandler, "WebSocketHandler must not be null");
this.paths = paths;
this.webSocketHandler = webSocketHandler;

View File

@@ -24,7 +24,6 @@ import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.config.SockJsServiceRegistration;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
/**
* Extends {@link AbstractMessageBrokerConfiguration} and adds configuration for
* receiving and responding to STOMP messages from WebSocket clients.

View File

@@ -45,8 +45,7 @@ import org.springframework.web.socket.support.WebSocketHttpHeaders;
* 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
* <p>If the negotiation succeeds, the actual upgrade is delegated to a server-specific
* {@link 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.
@@ -76,11 +75,9 @@ public class DefaultHandshakeHandler implements HandshakeHandler {
private final List<String> supportedProtocols = new ArrayList<String>();
/**
* Default constructor that auto-detects and instantiates a
* {@link RequestUpgradeStrategy} suitable for the runtime container.
*
* @throws IllegalStateException if no {@link RequestUpgradeStrategy} can be found.
*/
public DefaultHandshakeHandler() {
@@ -123,13 +120,13 @@ public class DefaultHandshakeHandler implements HandshakeHandler {
this.requestUpgradeStrategy = upgradeStrategy;
}
/**
* Use this property to configure the list of supported sub-protocols.
* The first configured sub-protocol that matches a client-requested sub-protocol
* is accepted. If there are no matches the response will not contain a
* {@literal Sec-WebSocket-Protocol} header.
* <p>
* Note that if the WebSocketHandler passed in at runtime is an instance of
* <p>Note that if the WebSocketHandler passed in at runtime is an instance of
* {@link SubProtocolCapable} then there is not need to explicitly configure
* this property. That is certainly the case with the built-in STOMP over
* WebSocket support. Therefore this property should be configured explicitly
@@ -263,11 +260,9 @@ public class DefaultHandshakeHandler implements HandshakeHandler {
* WebSocketHandler is a {@link SubProtocolCapable} and then also checks if any
* sub-protocols have been explicitly configured with
* {@link #setSupportedProtocols(String...)}.
*
* @param requestedProtocols the requested sub-protocols
* @param webSocketHandler the WebSocketHandler that will be used
* @return the selected protocols or {@code null}
*
* @see #determineHandlerSupportedProtocols(org.springframework.web.socket.WebSocketHandler)
*/
protected String selectProtocol(List<String> requestedProtocols, WebSocketHandler webSocketHandler) {
@@ -293,7 +288,6 @@ public class DefaultHandshakeHandler implements HandshakeHandler {
/**
* Determine the sub-protocols supported by the given WebSocketHandler by checking
* whether it is an instance of {@link SubProtocolCapable}.
*
* @param handler the handler to check
* @return a list of supported protocols or an empty list
*/
@@ -313,15 +307,12 @@ public class DefaultHandshakeHandler implements HandshakeHandler {
/**
* Filter the list of requested WebSocket extensions.
* <p>
* By default all request extensions are returned. The WebSocket server will further
* <p>By default all request extensions are returned. The WebSocket server will further
* compare the requested extensions against the list of supported extensions and
* return only the ones that are both requested and supported.
*
* @param request the current request
* @param requested the list of extensions requested by the client
* @param supported the list of extensions supported by the server
*
* @return the selected extensions or an empty list
*/
protected List<WebSocketExtension> filterRequestedExtensions(ServerHttpRequest request,

View File

@@ -34,7 +34,6 @@ import org.springframework.core.NestedRuntimeException;
@SuppressWarnings("serial")
public class HandshakeFailureException extends NestedRuntimeException {
/**
* Constructor with message and root cause.
*/

View File

@@ -35,26 +35,22 @@ import org.springframework.web.socket.support.PerConnectionWebSocketHandler;
*/
public interface HandshakeHandler {
/**
* Initiate the handshake.
*
* @param request the current request
* @param response the current response
* @param wsHandler the handler to process WebSocket messages; see
* {@link PerConnectionWebSocketHandler} for providing a handler with
* per-connection lifecycle.
* {@link PerConnectionWebSocketHandler} for providing a handler with
* per-connection lifecycle.
* @param attributes handshake request specific attributes to be set on the WebSocket
* session via {@link HandshakeInterceptor} and thus made available to the
* {@link WebSocketHandler};
*
* session via {@link HandshakeInterceptor} and thus made available to the
* {@link WebSocketHandler};
* @return whether the handshake negotiation was successful or not. In either case the
* response status, headers, and body will have been updated to reflect the
* result of the negotiation
*
* response status, headers, and body will have been updated to reflect the
* result of the negotiation
* @throws HandshakeFailureException thrown when handshake processing failed to
* complete due to an internal, unrecoverable error, i.e. a server error as
* opposed to a failure to successfully negotiate the handshake.
* complete due to an internal, unrecoverable error, i.e. a server error as
* opposed to a failure to successfully negotiate the handshake.
*/
boolean doHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler,
Map<String, Object> attributes) throws HandshakeFailureException;

View File

@@ -23,7 +23,6 @@ import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketSession;
/**
* Interceptor for WebSocket handshake requests. Can be used to inspect the handshake
* request and response as well as to pass attributes to the target
@@ -39,13 +38,11 @@ public interface HandshakeInterceptor {
/**
* Invoked before the handshake is processed.
*
* @param request the current request
* @param response the current response
* @param wsHandler the target WebSocket handler
* @param attributes attributes to make available via
* {@link WebSocketSession#getHandshakeAttributes()}
*
* {@link WebSocketSession#getHandshakeAttributes()}
* @return whether to proceed with the handshake {@code true} or abort {@code false}
*/
boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response,
@@ -54,7 +51,6 @@ public interface HandshakeInterceptor {
/**
* Invoked after the handshake is done. The response status and headers indicate the
* results of the handshake, i.e. whether it was successful or not.
*
* @param request the current request
* @param response the current response
* @param wsHandler the target WebSocket handler

View File

@@ -32,7 +32,6 @@ import org.springframework.web.socket.WebSocketHandler;
*/
public interface RequestUpgradeStrategy {
/**
* Return the supported WebSocket protocol versions.
*/
@@ -46,22 +45,19 @@ public interface RequestUpgradeStrategy {
/**
* Perform runtime specific steps to complete the upgrade. Invoked after successful
* negotiation of the handshake request.
*
*
* @param request the current request
* @param response the current response
* @param selectedProtocol the selected sub-protocol, if any
* @param selectedExtensions the selected WebSocket protocol extensions
* @param wsHandler the handler for WebSocket messages
* @param attributes handshake request specific attributes to be set on the WebSocket
* session via {@link org.springframework.web.socket.server.HandshakeInterceptor}
* and thus made available to the
* {@link org.springframework.web.socket.WebSocketHandler};
*
* session via {@link org.springframework.web.socket.server.HandshakeInterceptor}
* and thus made available to the
* {@link org.springframework.web.socket.WebSocketHandler};
* @throws HandshakeFailureException thrown when handshake processing failed to
* complete due to an internal, unrecoverable error, i.e. a server error as
* opposed to a failure to successfully negotiate the requirements of the
* handshake request.
* complete due to an internal, unrecoverable error, i.e. a server error as
* opposed to a failure to successfully negotiate the requirements of the
* handshake request.
*/
void upgrade(ServerHttpRequest request, ServerHttpResponse response,
String selectedProtocol, List<WebSocketExtension> selectedExtensions,

View File

@@ -29,7 +29,6 @@ import org.springframework.web.socket.server.HandshakeInterceptor;
import org.springframework.web.socket.sockjs.SockJsService;
import org.springframework.web.socket.sockjs.transport.handler.WebSocketTransportHandler;
/**
* Base class for {@link WebSocketHandlerRegistration}s that gathers all the configuration
* options but allows sub-classes to put together the actual HTTP request mappings.
@@ -54,6 +53,7 @@ public abstract class AbstractWebSocketHandlerRegistration<M> implements WebSock
this.sockJsTaskScheduler = defaultTaskScheduler;
}
@Override
public WebSocketHandlerRegistration addHandler(WebSocketHandler handler, String... paths) {
Assert.notNull(handler);

View File

@@ -20,7 +20,6 @@ import java.lang.annotation.Target;
import org.springframework.context.annotation.Import;
/**
* Add this annotation to an {@code @Configuration} class to configure
* processing WebSocket requests:

View File

@@ -30,7 +30,6 @@ import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler
import org.springframework.web.socket.sockjs.SockJsHttpRequestHandler;
import org.springframework.web.socket.sockjs.SockJsService;
/**
* A helper class for configuring {@link WebSocketHandler} request handling
* including SockJS fallback options.

View File

@@ -30,7 +30,6 @@ import org.springframework.web.servlet.handler.AbstractHandlerMapping;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.socket.WebSocketHandler;
/**
* A {@link WebSocketHandlerRegistry} that maps {@link WebSocketHandler}s to URLs for use
* in a Servlet container.

View File

@@ -27,7 +27,6 @@ import org.springframework.web.socket.sockjs.SockJsService;
import org.springframework.web.socket.sockjs.transport.TransportHandler;
import org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService;
/**
* A helper class for configuring SockJS fallback options, typically used indirectly, in
* conjunction with {@link EnableWebSocket @EnableWebSocket} and
@@ -79,7 +78,6 @@ public class SockJsServiceRegistration {
* a domain local to the SockJS server. The iframe does need to load the
* SockJS javascript client library and this option allows configuring its
* url.
*
* <p>By default this is set to point to
* "https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.4.min.js".
*/
@@ -96,7 +94,6 @@ public class SockJsServiceRegistration {
* closed. After that client will open a new request. Setting this value to
* one effectively disables streaming and will make streaming transports to
* behave like polling transports.
*
* <p>The default value is 128K (i.e. 128 * 1024).
*/
public SockJsServiceRegistration setStreamBytesLimit(int streamBytesLimit) {
@@ -109,13 +106,11 @@ public class SockJsServiceRegistration {
* from clients with a "cookie_needed" boolean property that indicates whether the use
* of a JSESSIONID cookie is required for the application to function correctly, e.g.
* for load balancing or in Java Servlet containers for the use of an HTTP session.
* <p>
* This is especially important for IE 8,9 that support XDomainRequest -- a modified
* <p>This is especially important for IE 8,9 that support XDomainRequest -- a modified
* AJAX/XHR -- that can do requests across domains but does not send any cookies. In
* those cases, the SockJS client prefers the "iframe-htmlfile" transport over
* "xdr-streaming" in order to be able to send cookies.
* <p>
* The default value is "true" to maximize the chance for applications to work
* <p>The default value is "true" to maximize the chance for applications to work
* correctly in IE 8,9 with support for cookies (and the JSESSIONID cookie in
* particular). However, an application can choose to set this to "false" if the use
* of cookies (and HTTP session) is not required.
@@ -129,7 +124,6 @@ public class SockJsServiceRegistration {
* The amount of time in milliseconds when the server has not sent any
* messages and after which the server should send a heartbeat frame to the
* client in order to keep the connection from breaking.
*
* <p>The default value is 25,000 (25 seconds).
*/
public SockJsServiceRegistration setHeartbeatTime(long heartbeatTime) {
@@ -141,7 +135,6 @@ public class SockJsServiceRegistration {
* The amount of time in milliseconds before a client is considered
* disconnected after not having a receiving connection, i.e. an active
* connection over which the server can send data to the client.
*
* <p>The default value is 5000.
*/
public SockJsServiceRegistration setDisconnectDelay(long disconnectDelay) {
@@ -153,12 +146,10 @@ public class SockJsServiceRegistration {
* The number of server-to-client messages that a session can cache while waiting for
* the next HTTP polling request from the client. All HTTP transports use this
* property since even streaming transports recycle HTTP requests periodically.
* <p>
* The amount of time between HTTP requests should be relatively brief and will not
* <p>The amount of time between HTTP requests should be relatively brief and will not
* exceed the allows disconnect delay (see
* {@link #setDisconnectDelay(long)}), 5 seconds by default.
* <p>
* The default size is 100.
* <p>The default size is 100.
*/
public SockJsServiceRegistration setHttpMessageCacheSize(int httpMessageCacheSize) {
this.httpMessageCacheSize = httpMessageCacheSize;
@@ -168,7 +159,6 @@ public class SockJsServiceRegistration {
/**
* Some load balancers don't support WebSocket. This option can be used to
* disable the WebSocket transport on the server side.
*
* <p>The default value is "true".
*/
public SockJsServiceRegistration setWebSocketEnabled(boolean webSocketEnabled) {

View File

@@ -21,7 +21,6 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.handler.AbstractHandlerMapping;
/**
* Configuration support for WebSocket request handling.
*
@@ -30,7 +29,6 @@ import org.springframework.web.servlet.handler.AbstractHandlerMapping;
*/
public class WebSocketConfigurationSupport {
@Bean
public HandlerMapping webSocketHandlerMapping() {
ServletWebSocketHandlerRegistry registry = new ServletWebSocketHandlerRegistry(defaultSockJsTaskScheduler());

View File

@@ -18,7 +18,6 @@ package org.springframework.web.socket.server.config;
import org.springframework.web.socket.WebSocketHandler;
/**
* Defines callback methods to configure the WebSocket request handling
* via {@link EnableWebSocket @EnableWebSocket}.
@@ -28,7 +27,6 @@ import org.springframework.web.socket.WebSocketHandler;
*/
public interface WebSocketConfigurer {
/**
* Register {@link WebSocketHandler}s including SockJS fallback options if desired.
*/

View File

@@ -73,7 +73,6 @@ public class ServerEndpointExporter implements InitializingBean, BeanPostProcess
* Explicitly list annotated endpoint types that should be registered on startup. This
* can be done if you wish to turn off a Servlet container's scan for endpoints, which
* goes through all 3rd party jars in the, and rely on Spring configuration instead.
*
* @param annotatedEndpointClasses {@link ServerEndpoint}-annotated types
*/
public void setAnnotatedEndpointClasses(Class<?>... annotatedEndpointClasses) {
@@ -83,11 +82,8 @@ public class ServerEndpointExporter implements InitializingBean, BeanPostProcess
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
this.serverContainer = getServerContainer();
Map<String, Object> beans = applicationContext.getBeansWithAnnotation(ServerEndpoint.class);
for (String beanName : beans.keySet()) {
Class<?> beanType = applicationContext.getType(beanName);
@@ -99,7 +95,6 @@ public class ServerEndpointExporter implements InitializingBean, BeanPostProcess
}
protected ServerContainer getServerContainer() {
Class<?> servletContextClass;
try {
servletContextClass = Class.forName("javax.servlet.ServletContext");
@@ -122,7 +117,6 @@ public class ServerEndpointExporter implements InitializingBean, BeanPostProcess
@Override
public void afterPropertiesSet() throws Exception {
Assert.state(this.serverContainer != null, "javax.websocket.server.ServerContainer not available");
List<Class<?>> allClasses = new ArrayList<Class<?>>(this.annotatedEndpointClasses);

View File

@@ -53,7 +53,6 @@ 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
* properties of the underlying {@link javax.websocket.server.ServerContainer} you can use

View File

@@ -28,7 +28,6 @@ import org.glassfish.tyrus.websockets.WebSocketApplication;
import org.springframework.util.ClassUtils;
import org.springframework.web.socket.support.WebSocketExtension;
/**
* Extension of the {@link AbstractGlassFishRequestUpgradeStrategy} that provides support
* for only GlassFish 4.0.

View File

@@ -20,7 +20,6 @@ import org.glassfish.tyrus.core.EndpointWrapper;
import org.glassfish.tyrus.core.TyrusEndpoint;
import org.glassfish.tyrus.websockets.WebSocketApplication;
/**
* Extension of the {@link AbstractGlassFishRequestUpgradeStrategy} that provides support
* for GlassFish 4.0.1 and beyond.

View File

@@ -27,7 +27,6 @@ import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.HandshakeInterceptor;
/**
* A helper class that assists with invoking a list of handshake interceptors.
*

View File

@@ -32,7 +32,6 @@ import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.server.HandshakeInterceptor;
/**
* An interceptor to copy HTTP session attributes into the map of "handshake attributes"
* made available through {@link WebSocketSession#getHandshakeAttributes()}.

View File

@@ -80,7 +80,7 @@ public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy {
* {@link WebSocketServerFactory#getPolicy()}.
*/
public JettyRequestUpgradeStrategy(WebSocketServerFactory factory) {
Assert.notNull(factory, "WebSocketServerFactory is required");
Assert.notNull(factory, "WebSocketServerFactory must not be null");
this.factory = factory;
this.factory.setCreator(new WebSocketCreator() {

View File

@@ -18,14 +18,13 @@ package org.springframework.web.socket.sockjs;
import java.util.List;
/**
* An exception thrown when a message frame was successfully received over an HTTP POST
* and parsed but one or more of the messages it contained could not be delivered to the
* WebSocketHandler either because the handler failed or because the connection got
* closed.
* <p>
* The SockJS session is not automatically closed after this exception.
*
* <p>The SockJS session is not automatically closed after this exception.
*
* @author Rossen Stoyanchev
* @since 4.0

View File

@@ -23,8 +23,8 @@ import org.springframework.web.socket.support.ExceptionWebSocketHandlerDecorator
/**
* The main entry point for processing HTTP requests from SockJS clients.
* <p>
* In a Servlet 3+ container, {@link SockJsHttpRequestHandler} can be used to invoke this
*
* <p>In a Servlet 3+ container, {@link SockJsHttpRequestHandler} can be used to invoke this
* service. The processing servlet, as well as all filters involved, must have
* asynchronous support enabled through the ServletContext API or by adding an
* {@code <async-support>true</async-support>} element to servlet and filter declarations
@@ -32,33 +32,28 @@ import org.springframework.web.socket.support.ExceptionWebSocketHandlerDecorator
*
* @author Rossen Stoyanchev
* @since 4.0
*
* @see SockJsHttpRequestHandler
*/
public interface SockJsService {
/**
* Process a SockJS HTTP request.
* <p>
* See the "Base URL", "Static URLs", and "Session URLs" sections of the <a
* <p>See the "Base URL", "Static URLs", and "Session URLs" sections of the <a
* href="http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html">SockJS
* protocol</a> for details on the types of URLs expected.
*
* @param request the current request
* @param response the current response
* @param sockJsPath the remainder of the path within the SockJS service prefix
* @param handler the handler that will exchange messages with the SockJS client
*
* @throws SockJsException raised when request processing fails; generally, failed
* attempts to send messages to clients automatically close the SockJS session
* and raise {@link SockJsTransportFailureException}; failed attempts to read
* messages from clients do not automatically close the session and may result
* in {@link SockJsMessageDeliveryException} or {@link SockJsException};
* exceptions from the WebSocketHandler can be handled internally or through
* {@link ExceptionWebSocketHandlerDecorator} or some alternative decorator.
* The former is automatically added when using
* {@link SockJsHttpRequestHandler}.
* attempts to send messages to clients automatically close the SockJS session
* and raise {@link SockJsTransportFailureException}; failed attempts to read
* messages from clients do not automatically close the session and may result
* in {@link SockJsMessageDeliveryException} or {@link SockJsException};
* exceptions from the WebSocketHandler can be handled internally or through
* {@link ExceptionWebSocketHandlerDecorator} or some alternative decorator.
* The former is automatically added when using
* {@link SockJsHttpRequestHandler}.
*/
void handleRequest(ServerHttpRequest request, ServerHttpResponse response, String sockJsPath,
WebSocketHandler handler) throws SockJsException;

View File

@@ -16,7 +16,6 @@
package org.springframework.web.socket.sockjs;
/**
* Indicates a serious failure that occurred in the SockJS implementation as opposed to in
* user code (e.g. IOException while writing to the response). When this exception is
@@ -28,7 +27,6 @@ package org.springframework.web.socket.sockjs;
@SuppressWarnings("serial")
public class SockJsTransportFailureException extends SockJsException {
public SockJsTransportFailureException(String message, String sessionId, Throwable cause) {
super(message, sessionId, cause);
}

View File

@@ -102,7 +102,6 @@ public abstract class AbstractSockJsService implements SockJsService {
* a domain local to the SockJS server. The iframe does need to load the
* SockJS javascript client library and this option allows configuring its
* url.
*
* <p>By default this is set to point to
* "https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.4.min.js".
*/
@@ -126,7 +125,6 @@ public abstract class AbstractSockJsService implements SockJsService {
* closed. After that client will open a new request. Setting this value to
* one effectively disables streaming and will make streaming transports to
* behave like polling transports.
*
* <p>The default value is 128K (i.e. 128 * 1024).
*/
public void setStreamBytesLimit(int streamBytesLimit) {
@@ -142,17 +140,14 @@ public abstract class AbstractSockJsService implements SockJsService {
* clients with a "cookie_needed" boolean property that indicates whether the use of a
* JSESSIONID cookie is required for the application to function correctly, e.g. for
* load balancing or in Java Servlet containers for the use of an HTTP session.
* <p>
* This is especially important for IE 8,9 that support XDomainRequest -- a modified
* <p>This is especially important for IE 8,9 that support XDomainRequest -- a modified
* AJAX/XHR -- that can do requests across domains but does not send any cookies. In
* those cases, the SockJS client prefers the "iframe-htmlfile" transport over
* "xdr-streaming" in order to be able to send cookies.
* <p>
* The SockJS protocol also expects a SockJS service to echo back the JSESSIONID
* <p>The SockJS protocol also expects a SockJS service to echo back the JSESSIONID
* cookie when this property is set to true. However, when running in a Servlet
* container this is not necessary since the container takes care of it.
* <p>
* The default value is "true" to maximize the chance for applications to work
* <p>The default value is "true" to maximize the chance for applications to work
* correctly in IE 8,9 with support for cookies (and the JSESSIONID cookie in
* particular). However, an application can choose to set this to "false" if
* the use of cookies (and HTTP session) is not required.
@@ -173,7 +168,6 @@ public abstract class AbstractSockJsService implements SockJsService {
* The amount of time in milliseconds when the server has not sent any
* messages and after which the server should send a heartbeat frame to the
* client in order to keep the connection from breaking.
*
* <p>The default value is 25,000 (25 seconds).
*/
public void setHeartbeatTime(long heartbeatTime) {
@@ -195,7 +189,6 @@ public abstract class AbstractSockJsService implements SockJsService {
* The amount of time in milliseconds before a client is considered
* disconnected after not having a receiving connection, i.e. an active
* connection over which the server can send data to the client.
*
* <p>The default value is 5000.
*/
public void setDisconnectDelay(long disconnectDelay) {
@@ -213,12 +206,10 @@ public abstract class AbstractSockJsService implements SockJsService {
* The number of server-to-client messages that a session can cache while waiting for
* the next HTTP polling request from the client. All HTTP transports use this
* property since even streaming transports recycle HTTP requests periodically.
* <p>
* The amount of time between HTTP requests should be relatively brief and will not
* <p>The amount of time between HTTP requests should be relatively brief and will not
* exceed the allows disconnect delay (see
* {@link #setDisconnectDelay(long)}), 5 seconds by default.
* <p>
* The default size is 100.
* <p>The default size is 100.
*/
public void setHttpMessageCacheSize(int httpMessageCacheSize) {
this.httpMessageCacheSize = httpMessageCacheSize;
@@ -234,7 +225,6 @@ public abstract class AbstractSockJsService implements SockJsService {
/**
* Some load balancers don't support websockets. This option can be used to
* disable the WebSocket transport on the server side.
*
* <p>The default value is "true".
*/
public void setWebSocketsEnabled(boolean webSocketsEnabled) {
@@ -251,9 +241,8 @@ public abstract class AbstractSockJsService implements SockJsService {
/**
* {@inheritDoc}
* <p>
* This method determines the SockJS path and handles SockJS static URLs. Session URLs
* and raw WebSocket requests are delegated to abstract methods.
* <p>This method determines the SockJS path and handles SockJS static URLs. Session
* URLs and raw WebSocket requests are delegated to abstract methods.
*/
@Override
public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response,

View File

@@ -18,7 +18,6 @@ package org.springframework.web.socket.sockjs.support.frame;
import org.springframework.util.Assert;
/**
* An base class for SockJS message codec that provides an implementation of
* {@link #encode(String[])}.

View File

@@ -24,7 +24,6 @@ import org.springframework.util.Assert;
import com.fasterxml.jackson.core.io.JsonStringEncoder;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* A Jackson 2 codec for encoding and decoding SockJS messages.
*
@@ -41,7 +40,7 @@ public class Jackson2SockJsMessageCodec extends AbstractSockJsMessageCodec {
}
public Jackson2SockJsMessageCodec(ObjectMapper objectMapper) {
Assert.notNull(objectMapper, "objectMapper is required");
Assert.notNull(objectMapper, "ObjectMapper must not be null");
this.objectMapper = objectMapper;
}

View File

@@ -23,7 +23,6 @@ import org.codehaus.jackson.io.JsonStringEncoder;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.util.Assert;
/**
* A Jackson 1.x codec for encoding and decoding SockJS messages.
*
@@ -40,7 +39,7 @@ public class JacksonSockJsMessageCodec extends AbstractSockJsMessageCodec {
}
public JacksonSockJsMessageCodec(ObjectMapper objectMapper) {
Assert.notNull(objectMapper, "objectMapper is required");
Assert.notNull(objectMapper, "ObjectMapper must not be null");
this.objectMapper = objectMapper;
}

View File

@@ -41,7 +41,7 @@ public class SockJsFrame {
private SockJsFrame(String content) {
Assert.notNull("content is required");
Assert.notNull("Content must not be null");
this.content = content;
}

View File

@@ -19,7 +19,6 @@ package org.springframework.web.socket.sockjs.support.frame;
import java.io.IOException;
import java.io.InputStream;
/**
* Encode and decode messages to and from a SockJS message frame, essentially an array of
* JSON-encoded messages. For example:
@@ -33,13 +32,11 @@ import java.io.InputStream;
*/
public interface SockJsMessageCodec {
/**
* Encode the given messages as a SockJS message frame. Aside from applying standard
* JSON quoting to each message, there are some additional JSON Unicode escaping
* rules. See the "JSON Unicode Encoding" section of SockJS protocol (i.e. the
* protocol test suite).
*
* @param messages the messages to encode
* @return the content for a SockJS message frame, never {@code null}
*/
@@ -47,7 +44,6 @@ public interface SockJsMessageCodec {
/**
* Decode the given SockJS message frame.
*
* @param content the SockJS message frame
* @return an array of messages or {@code null}
* @throws IOException if the content could not be parsed
@@ -56,7 +52,6 @@ public interface SockJsMessageCodec {
/**
* Decode the given SockJS message frame.
*
* @param content the SockJS message frame
* @return an array of messages or {@code null}
* @throws IOException if the content could not be parsed

View File

@@ -31,7 +31,6 @@ import org.springframework.web.socket.sockjs.SockJsService;
*/
public interface TransportHandler {
/**
* @return the transport type supported by this handler
*/

View File

@@ -42,7 +42,6 @@ import com.fasterxml.jackson.databind.JsonMappingException;
public abstract class AbstractHttpReceivingTransportHandler
extends TransportHandlerSupport implements TransportHandler {
@Override
public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response,
WebSocketHandler wsHandler, WebSocketSession wsSession) throws SockJsException {

View File

@@ -56,7 +56,6 @@ import org.springframework.web.socket.sockjs.transport.TransportType;
import org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.SockJsServiceConfig;
/**
* A default implementation of {@link SockJsService} adding support for transport handling
* and session management. See {@link AbstractSockJsService} base class for important
@@ -87,11 +86,10 @@ public class DefaultSockJsService extends AbstractSockJsService {
/**
* Create an instance with default {@link TransportHandler transport handler} types.
*
* @param taskScheduler a task scheduler for heart-beat messages and removing
* timed-out sessions; the provided TaskScheduler should be declared as a
* Spring bean to ensure it is initialized at start up and shut down when the
* application stops.
* timed-out sessions; the provided TaskScheduler should be declared as a
* Spring bean to ensure it is initialized at start up and shut down when the
* application stops.
*/
public DefaultSockJsService(TaskScheduler taskScheduler) {
this(taskScheduler, null);
@@ -100,15 +98,14 @@ public class DefaultSockJsService extends AbstractSockJsService {
/**
* Create an instance by overriding or replacing completely the default
* {@link TransportHandler transport handler} types.
*
* @param taskScheduler a task scheduler for heart-beat messages and removing
* timed-out sessions; the provided TaskScheduler should be declared as a
* Spring bean to ensure it is initialized at start up and shut down when the
* application stops.
* timed-out sessions; the provided TaskScheduler should be declared as a
* Spring bean to ensure it is initialized at start up and shut down when the
* application stops.
* @param transportHandlers the transport handlers to use (replaces the default ones);
* can be {@code null} if you don't want to install the default ones.
* can be {@code null} if you don't want to install the default ones.
* @param transportHandlerOverrides zero or more overrides to the default transport
* handler types.
* handler types.
*/
public DefaultSockJsService(TaskScheduler taskScheduler, Collection<TransportHandler> transportHandlers,
TransportHandler... transportHandlerOverrides) {

View File

@@ -40,7 +40,7 @@ import org.springframework.web.util.JavaScriptUtils;
/**
* An HTTP {@link TransportHandler} that uses a famous browsder document.domain technique:
* <a href="http://stackoverflow.com/questions/1481251/what-does-document-domain-document-domain-do">
* http://stackoverflow.com/questions/1481251/what-does-document-domain-document-domain-do</a>
* http://stackoverflow.com/questions/1481251/what-does-document-domain-document-domain-do</a>
*
* @author Rossen Stoyanchev
* @since 4.0

View File

@@ -33,11 +33,9 @@ public interface SockJsSessionFactory {
/**
* Create a new SockJS session.
*
* @param sessionId the ID of the session
* @param wsHandler the underlying {@link WebSocketHandler}
* @param attributes handshake request specific attributes
*
* @return a new session, never {@code null}
*/
AbstractSockJsSession createSession(String sessionId, WebSocketHandler wsHandler, Map<String, Object> attributes);

View File

@@ -20,7 +20,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.socket.sockjs.transport.session.SockJsServiceConfig;
/**
* @author Rossen Stoyanchev
* @since 4.0

View File

@@ -128,7 +128,6 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
* Unlike WebSocket where sub-protocol negotiation is part of the
* initial handshake, in HTTP transports the same negotiation must
* be emulated and the selected protocol set through this setter.
*
* @param protocol the sub-protocol to set
*/
public void setAcceptedProtocol(String protocol) {

View File

@@ -73,9 +73,9 @@ public abstract class AbstractSockJsSession implements WebSocketSession {
public AbstractSockJsSession(String id, SockJsServiceConfig config,
WebSocketHandler wsHandler, Map<String, Object> handshakeAttributes) {
Assert.notNull(id, "sessionId is required");
Assert.notNull(config, "sockJsConfig is required");
Assert.notNull(wsHandler, "webSocketHandler is required");
Assert.notNull(id, "SessionId must not be null");
Assert.notNull(config, "SockJsConfig must not be null");
Assert.notNull(wsHandler, "WebSocketHandler must not be null");
this.id = id;
this.config = config;
@@ -208,7 +208,6 @@ public abstract class AbstractSockJsSession implements WebSocketSession {
/**
* {@inheritDoc}
*
* <p>Performs cleanup and notifies the {@link WebSocketHandler}.
*/
@Override

View File

@@ -38,7 +38,6 @@ public interface SockJsServiceConfig {
* closed. After that client will open a new request. Setting this value to
* one effectively disables streaming and will make streaming transports to
* behave like polling transports.
*
* <p>The default value is 128K (i.e. 128 * 1024).
*/
int getStreamBytesLimit();
@@ -47,7 +46,6 @@ public interface SockJsServiceConfig {
* The amount of time in milliseconds when the server has not sent any
* messages and after which the server should send a heartbeat frame to the
* client in order to keep the connection from breaking.
*
* <p>The default value is 25,000 (25 seconds).
*/
long getHeartbeatTime();
@@ -67,12 +65,10 @@ public interface SockJsServiceConfig {
* The number of server-to-client messages that a session can cache while waiting for
* the next HTTP polling request from the client. All HTTP transports use this
* property since even streaming transports recycle HTTP requests periodically.
* <p>
* The amount of time between HTTP requests should be relatively brief and will not
* <p>The amount of time between HTTP requests should be relatively brief and will not
* exceed the allows disconnect delay (see
* {@link AbstractSockJsService#setDisconnectDelay(long)}, 5 seconds by default.
* <p>
* The default size is 100.
* <p>The default size is 100.
*/
int getHttpMessageCacheSize();

View File

@@ -34,16 +34,14 @@ import org.springframework.web.socket.WebSocketSession;
* A {@link WebSocketHandler} that initializes and destroys a {@link WebSocketHandler}
* instance for each WebSocket connection and delegates all other methods to it.
*
* <p>
* Essentially create an instance of this class once, providing the type of
* <p>Essentially create an instance of this class once, providing the type of
* {@link WebSocketHandler} class to create for each connection, and then pass it to any
* API method that expects a {@link WebSocketHandler}.
*
* <p>
* If initializing the target {@link WebSocketHandler} type requires a Spring BeanFctory,
* then the {@link #setBeanFactory(BeanFactory)} property accordingly. Simply declaring
* this class as a Spring bean will do that. Otherwise, {@link WebSocketHandler} instances
* of the target type will be created using the default constructor.
* <p>If initializing the target {@link WebSocketHandler} type requires a Spring
* BeanFctory, then the {@link #setBeanFactory(BeanFactory)} property accordingly. Simply
* declaring this class as a Spring bean will do that. Otherwise, {@link WebSocketHandler}
* instances of the target type will be created using the default constructor.
*
* @author Rossen Stoyanchev
* @since 4.0

View File

@@ -7,7 +7,6 @@ import java.util.List;
*
* @author Rossen Stoyanchev
* @since 4.0
*
* @see <a href="http://tools.ietf.org/html/rfc6455#section-1.9">RFC-6455 section 1.9</a>
*/
public interface SubProtocolCapable {

View File

@@ -48,8 +48,7 @@ import org.springframework.util.StringUtils;
*
* @author Brian Clozel
* @since 4.0
* @see <a href="https://tools.ietf.org/html/rfc6455#section-9">
* WebSocket Protocol Extensions, RFC 6455 - Section 9</a>
* @see <a href="https://tools.ietf.org/html/rfc6455#section-9">WebSocket Protocol Extensions, RFC 6455 - Section 9</a>
*/
public class WebSocketExtension {
@@ -60,7 +59,6 @@ public class WebSocketExtension {
/**
* Create a WebSocketExtension with the given name.
*
* @param name the name of the extension
*/
public WebSocketExtension(String name) {
@@ -69,7 +67,6 @@ public class WebSocketExtension {
/**
* Create a WebSocketExtension with the given name and parameters.
*
* @param name the name of the extension
* @param parameters the parameters
*/

View File

@@ -60,7 +60,6 @@ public class WebSocketHttpHeaders extends HttpHeaders {
/**
* Create an instance that wraps the given pre-existing HttpHeaders and also
* propagate all changes to it.
*
* @param headers the HTTP headers to wrap
*/
public WebSocketHttpHeaders(HttpHeaders headers) {