]> source.dussan.org Git - vaadin-framework.git/commitdiff
Ensure refresh message is sent on invalid CSRF (#17042)
authorArtur Signell <artur@vaadin.com>
Fri, 6 Mar 2015 12:24:00 +0000 (14:24 +0200)
committerLeif Åstrand <leif@vaadin.com>
Fri, 6 Mar 2015 12:44:25 +0000 (12:44 +0000)
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

server/src/com/vaadin/server/communication/PushHandler.java

index 22eee70aa01d541236a6107c981d76c3687f48ca..c570d220868b4bd60a127c88955c9300059a82ad 100644 (file)
@@ -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));
     }
 
     /**