From f3fb1b714780af4dfd02bbf5fc20510dd567d719 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 6 Mar 2015 14:24:00 +0200 Subject: 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 --- .../com/vaadin/server/communication/PushHandler.java | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'server') 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)); } /** -- cgit v1.2.3