diff options
author | Artur Signell <artur@vaadin.com> | 2015-03-06 14:24:00 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2015-03-06 12:44:25 +0000 |
commit | 789995e01e79944d45797d31b640b42fa34b115c (patch) | |
tree | ee87e6b29451b05f953aecfb69c25475b38699ad | |
parent | bb73827b48e54086e24415df0ae19e44a098ac87 (diff) | |
download | vaadin-framework-789995e01e79944d45797d31b640b42fa34b115c.tar.gz vaadin-framework-789995e01e79944d45797d31b640b42fa34b115c.zip |
Ensure refresh message is sent on invalid CSRF (#17042)
If we create an AtmospherePushConnection and a broadcaster like before we would
need to suspend the connection to ensure the AtmosphereResource is actually
added to the broadcaster
Change-Id: I7265ac0594b7a4da2c7a49fa34ebfbb27e1abdff
-rw-r--r-- | server/src/com/vaadin/server/communication/PushHandler.java | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/server/src/com/vaadin/server/communication/PushHandler.java b/server/src/com/vaadin/server/communication/PushHandler.java index 22eee70aa0..c570d22086 100644 --- a/server/src/com/vaadin/server/communication/PushHandler.java +++ b/server/src/com/vaadin/server/communication/PushHandler.java @@ -470,23 +470,9 @@ public class PushHandler extends AtmosphereResourceEventListenerAdapter { */ private static void sendRefreshAndDisconnect(AtmosphereResource resource) throws IOException { - if (resource instanceof AtmosphereResourceImpl - && !((AtmosphereResourceImpl) resource).isInScope()) { - // The resource is no longer valid so we should not write - // anything to it - getLogger() - .fine("sendRefreshAndDisconnect called for resource no longer in scope"); - return; - } - - AtmospherePushConnection connection = new AtmospherePushConnection(null); - connection.connect(resource); - try { - connection.sendMessage(VaadinService - .createCriticalNotificationJSON(null, null, null, null)); - } finally { - connection.disconnect(); - } + sendNotificationAndDisconnect(resource, + VaadinService.createCriticalNotificationJSON(null, null, null, + null)); } /** |