SPR-14901 Allow customization of STOMP message header encoding

Fixes SPR-14901
This commit is contained in:
Christoph Dreis
2016-11-11 21:41:25 +01:00
committed by Rossen Stoyanchev
parent 2735cba4b3
commit 9b76dc2ab4
3 changed files with 69 additions and 12 deletions

View File

@@ -142,7 +142,6 @@ public class WebMvcStompEndpointRegistry implements StompEndpointRegistry {
this.stompHandler.setApplicationEventPublisher(applicationContext);
}
/**
* Return a handler mapping with the mapped ViewControllers; or {@code null}
* in case of no registrations.

View File

@@ -88,14 +88,13 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
private static final byte[] EMPTY_PAYLOAD = new byte[0];
private StompSubProtocolErrorHandler errorHandler;
private int messageSizeLimit = 64 * 1024;
private final StompEncoder stompEncoder = new StompEncoder();
private StompEncoder stompEncoder;
private final StompDecoder stompDecoder = new StompDecoder();
private StompDecoder stompDecoder;
private final Map<String, BufferingStompDecoder> decoders = new ConcurrentHashMap<>();
@@ -107,6 +106,10 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
private final Stats stats = new Stats();
public StompSubProtocolHandler() {
setEncoder(new StompEncoder());
setDecoder(new StompDecoder());
}
/**
* Configure a handler for error messages sent to clients which allows
@@ -126,6 +129,24 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
return this.errorHandler;
}
/**
* Configure a {@link StompEncoder} for encoding STOMP frames
* @param encoder the encoder
* @since 4.3.5
*/
public void setEncoder(StompEncoder encoder) {
this.stompEncoder = encoder;
}
/**
* Configure a {@link StompDecoder} for decoding STOMP frames
* @param decoder the decoder
* @since 4.3.5
*/
public void setDecoder(StompDecoder decoder) {
this.stompDecoder = decoder;
}
/**
* Configure the maximum size allowed for an incoming STOMP message.
* Since a STOMP message can be received in multiple WebSocket messages,