From a705bda61f6b0ccfab86e7b6113ed39cdb818407 Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Sun, 1 Oct 2023 21:18:18 +0200 Subject: [PATCH] Issue #201 - WebSocketMessageSenderDefault.sendTo() fails when no Wicket application is bound to the current thread - Use the application passed to the constructor instead of the thread-bound application --- .../servlet/websocket/WebSocketMessageSenderDefault.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/servlet/websocket/WebSocketMessageSenderDefault.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/servlet/websocket/WebSocketMessageSenderDefault.java index 5a9da1d2..ebcae4f0 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/servlet/websocket/WebSocketMessageSenderDefault.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/servlet/websocket/WebSocketMessageSenderDefault.java @@ -34,11 +34,12 @@ public void sendToAll(IWebSocketPushMessage event) { } } - public void sendTo(Object identifier, IWebSocketPushMessage event) { + @Override + public void sendTo(Object identifier, IWebSocketPushMessage event) { if(identifier == null) { return; } - Application application = Application.get(); + WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); IWebSocketConnectionRegistry connectionRegistry = webSocketSettings.getConnectionRegistry(); wicketSessionResolver.resolve(identifier).forEach(sessionId -> { @@ -49,5 +50,4 @@ public void sendTo(Object identifier, IWebSocketPushMessage event) { } }); } - }