From f57f33710458ea982e00d71b3c885c461fe779ea Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Tue, 26 Nov 2019 12:08:22 +0000 Subject: [PATCH] Protected method to decorate WebSocketHandler See gh-24075 --- .../server/support/WebSocketHttpRequestHandler.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/server/support/WebSocketHttpRequestHandler.java b/spring-websocket/src/main/java/org/springframework/web/socket/server/support/WebSocketHttpRequestHandler.java index d4abeba3ace9..1399bf7617cb 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/server/support/WebSocketHttpRequestHandler.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/server/support/WebSocketHttpRequestHandler.java @@ -77,10 +77,20 @@ public WebSocketHttpRequestHandler(WebSocketHandler wsHandler) { public WebSocketHttpRequestHandler(WebSocketHandler wsHandler, HandshakeHandler handshakeHandler) { Assert.notNull(wsHandler, "wsHandler must not be null"); Assert.notNull(handshakeHandler, "handshakeHandler must not be null"); - this.wsHandler = new ExceptionWebSocketHandlerDecorator(new LoggingWebSocketHandlerDecorator(wsHandler)); + this.wsHandler = decorate(wsHandler); this.handshakeHandler = handshakeHandler; } + /** + * Decorate the {@code WebSocketHandler} passed into the constructor. + *

By default, {@link LoggingWebSocketHandlerDecorator} and + * {@link ExceptionWebSocketHandlerDecorator} are added. + * @since 5.2.2 + */ + protected WebSocketHandler decorate(WebSocketHandler handler) { + return new ExceptionWebSocketHandlerDecorator(new LoggingWebSocketHandlerDecorator(handler)); + } + /** * Return the WebSocketHandler.