Top Description Fields Constructors Methods
org.springframework.web.socket.handler

public Class WebSocketHandlerDecorator

extends Object
implements WebSocketHandler
Class Inheritance
All Implemented Interfaces
org.springframework.web.socket.WebSocketHandler
Known Direct Subclasses
org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator, org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator
Imports
org.springframework.util.Assert, org.springframework.web.socket.CloseStatus, .WebSocketHandler, .WebSocketMessage, .WebSocketSession

Wraps another org.springframework.web.socket.WebSocketHandler instance and delegates to it.

Also provides a getDelegate() method to return the decorated handler as well as a getLastHandler() method to go through all nested delegates and return the "last" handler.

Author
Rossen Stoyanchev
Since
4.0

Field Summary

Modifier and TypeField and Description
private final WebSocketHandler

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus)

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionClosed.

Invoked after the WebSocket connection has been closed by either side, or after a transport error has occurred.

public void
afterConnectionEstablished(WebSocketSession session)

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished.

Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.

public WebSocketHandler
public WebSocketHandler
public void
handleMessage(WebSocketSession session, WebSocketMessage<?> message)

Implements org.springframework.web.socket.WebSocketHandler.handleMessage.

Invoked when a new WebSocket message arrives.

public void
handleTransportError(WebSocketSession session, Throwable exception)

Implements org.springframework.web.socket.WebSocketHandler.handleTransportError.

Handle an error from the underlying WebSocket message transport.

public boolean
supportsPartialMessages()

Implements org.springframework.web.socket.WebSocketHandler.supportsPartialMessages.

Whether the WebSocketHandler handles partial messages.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public static WebSocketHandler
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

delegateback to summary
private final WebSocketHandler delegate

Constructor Detail

WebSocketHandlerDecoratorback to summary
public WebSocketHandlerDecorator(WebSocketHandler delegate)

Method Detail

afterConnectionClosedback to summary
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionClosed.

Doc from org.springframework.web.socket.WebSocketHandler.afterConnectionClosed.

Invoked after the WebSocket connection has been closed by either side, or after a 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.

Annotations
@Override
Exceptions
Exception:
this method can handle or propagate exceptions; see class-level Javadoc for details.
afterConnectionEstablishedback to summary
public void afterConnectionEstablished(WebSocketSession session) throws Exception

Implements org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished.

Doc from org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished.

Invoked after WebSocket negotiation has succeeded and the WebSocket connection is opened and ready for use.

Annotations
@Override
Exceptions
Exception:
this method can handle or propagate exceptions; see class-level Javadoc for details.
getDelegateback to summary
public WebSocketHandler getDelegate()
getLastHandlerback to summary
public WebSocketHandler getLastHandler()
handleMessageback to summary
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception

Implements org.springframework.web.socket.WebSocketHandler.handleMessage.

Doc from org.springframework.web.socket.WebSocketHandler.handleMessage.

Invoked when a new WebSocket message arrives.

Annotations
@Override
Exceptions
Exception:
this method can handle or propagate exceptions; see class-level Javadoc for details.
handleTransportErrorback to summary
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception

Implements org.springframework.web.socket.WebSocketHandler.handleTransportError.

Doc from org.springframework.web.socket.WebSocketHandler.handleTransportError.

Handle an error from the underlying WebSocket message transport.

Annotations
@Override
Exceptions
Exception:
this method can handle or propagate exceptions; see class-level Javadoc for details.
supportsPartialMessagesback to summary
public boolean supportsPartialMessages()

Implements org.springframework.web.socket.WebSocketHandler.supportsPartialMessages.

Doc from org.springframework.web.socket.WebSocketHandler.supportsPartialMessages.

Whether the WebSocketHandler handles partial messages. If this flag is set to true and the underlying WebSocket server supports partial messages, then a large WebSocket message, or one of an unknown size may be split and maybe received over multiple calls to handleMessage(WebSocketSession, WebSocketMessage). The flag org.springframework.web.socket.WebSocketMessage#isLast() indicates if the message is partial and whether it is the last part.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
unwrapback to summary
public static WebSocketHandler unwrap(WebSocketHandler handler)