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

public Class StompSubProtocolErrorHandler

extends Object
implements SubProtocolErrorHandler<byte[]>
Class Inheritance
All Implemented Interfaces
org.springframework.web.socket.messaging.SubProtocolErrorHandler
Imports
org.springframework.lang.Nullable, org.springframework.messaging.Message, org.springframework.messaging.simp.stomp.StompCommand, .StompHeaderAccessor, org.springframework.messaging.support.MessageBuilder, .MessageHeaderAccessor, org.springframework.util.Assert

A SubProtocolErrorHandler for use with STOMP.
Author
Rossen Stoyanchev
Since
4.2

Field Summary

Modifier and TypeField and Description
private static final byte[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Message<byte[]>
handleClientMessageProcessingError(Message<byte[]>
the client message related to the error, possibly null if error occurred while parsing a WebSocket message
clientMessage
,
Throwable
the cause for the error, never null
ex
)

Implements org.springframework.web.socket.messaging.SubProtocolErrorHandler.handleClientMessageProcessingError.

Handle errors thrown while processing client messages providing an opportunity to prepare the error message or to prevent one from being sent.

public Message<byte[]>
handleErrorMessageToClient(Message<byte[]>
the error message, never null
errorMessage
)

Implements org.springframework.web.socket.messaging.SubProtocolErrorHandler.handleErrorMessageToClient.

Handle errors sent from the server side to clients, e.g. errors from the "broke relay" because connectivity failed or the external broker sent an error message, etc.

protected Message<byte[]>
handleInternal(StompHeaderAccessor errorHeaderAccessor, byte[] errorPayload, Throwable cause, StompHeaderAccessor clientHeaderAccessor)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_PAYLOADback to summary
private static final byte[] EMPTY_PAYLOAD

Constructor Detail

StompSubProtocolErrorHandlerback to summary
public StompSubProtocolErrorHandler()

Method Detail

handleClientMessageProcessingErrorback to summary
public Message<byte[]> handleClientMessageProcessingError(Message<byte[]> clientMessage, Throwable ex)

Implements org.springframework.web.socket.messaging.SubProtocolErrorHandler.handleClientMessageProcessingError.

Doc from org.springframework.web.socket.messaging.SubProtocolErrorHandler.handleClientMessageProcessingError.

Handle errors thrown while processing client messages providing an opportunity to prepare the error message or to prevent one from being sent.

Note that the STOMP protocol requires a server to close the connection after sending an ERROR frame. To prevent an ERROR frame from being sent, a handler could return null and send a notification message through the broker instead, e.g. via a user destination.

Parameters
clientMessage:Message<byte[]>

the client message related to the error, possibly null if error occurred while parsing a WebSocket message

ex:Throwable

the cause for the error, never null

Returns:Message<byte[]>

the error message to send to the client, or null in which case no message will be sent.

Annotations
@Override
@Nullable
handleErrorMessageToClientback to summary
public Message<byte[]> handleErrorMessageToClient(Message<byte[]> errorMessage)

Implements org.springframework.web.socket.messaging.SubProtocolErrorHandler.handleErrorMessageToClient.

Doc from org.springframework.web.socket.messaging.SubProtocolErrorHandler.handleErrorMessageToClient.

Handle errors sent from the server side to clients, e.g. errors from the "broke relay" because connectivity failed or the external broker sent an error message, etc.

Parameters
errorMessage:Message<byte[]>

the error message, never null

Returns:Message<byte[]>

the error message to send to the client, or null in which case no message will be sent.

Annotations
@Override
@Nullable
handleInternalback to summary
protected Message<byte[]> handleInternal(StompHeaderAccessor errorHeaderAccessor, byte[] errorPayload, Throwable cause, StompHeaderAccessor clientHeaderAccessor)