diff options
author | Artur Signell <artur@vaadin.com> | 2015-03-06 14:24:00 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2015-03-11 12:53:34 +0200 |
commit | f3fb1b714780af4dfd02bbf5fc20510dd567d719 (patch) | |
tree | 5b9af0f0bdcfc9ef00981a8c487e0be5686604e9 /server | |
parent | def8dba5c6c153c5945b149ee7eec795d8779e91 (diff) | |
download | vaadin-framework-f3fb1b714780af4dfd02bbf5fc20510dd567d719.tar.gz vaadin-framework-f3fb1b714780af4dfd02bbf5fc20510dd567d719.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
Diffstat (limited to 'server')
-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)); } /** |