Protected method to decorate WebSocketHandler

See gh-24075
This commit is contained in:
Rossen Stoyanchev 2019-11-26 12:08:22 +00:00
parent 526d89e1e6
commit f57f337104
1 changed files with 11 additions and 1 deletions

View File

@ -77,10 +77,20 @@ public class WebSocketHttpRequestHandler implements HttpRequestHandler, Lifecycl
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.
* <p>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.