From 3b7ddf8aa06379a09ff534ae1a89977164937b89 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 17 Apr 2015 22:36:03 +0300 Subject: Backport a resynchronization fix for 7.5 (#15405) Change-Id: I62178ada54de6a814704dd7e166e9e9e3403c83b --- .../server/communication/ServerRpcHandler.java | 24 +++++++++++++++++++++- .../server/communication/UidlRequestHandler.java | 4 +++- 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'server/src') diff --git a/server/src/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/com/vaadin/server/communication/ServerRpcHandler.java index 450c11f5c4..65fb144810 100644 --- a/server/src/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/com/vaadin/server/communication/ServerRpcHandler.java @@ -76,13 +76,14 @@ public class ServerRpcHandler implements Serializable { private final JsonArray invocations; private final int syncId; private final JsonObject json; + private final boolean resynchronize; public RpcRequest(String jsonString, VaadinRequest request) { json = JsonUtil.parse(jsonString); JsonValue token = json.get(ApplicationConstants.CSRF_TOKEN); if (token == null) { - this.csrfToken = ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE; + csrfToken = ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE; } else { String csrfToken = token.asString(); if (csrfToken.equals("")) { @@ -98,6 +99,14 @@ public class ServerRpcHandler implements Serializable { } else { syncId = -1; } + + if (json.hasKey(ApplicationConstants.RESYNCHRONIZE_ID)) { + resynchronize = json + .getBoolean(ApplicationConstants.RESYNCHRONIZE_ID); + } else { + resynchronize = false; + } + invocations = json.getArray(ApplicationConstants.RPC_INVOCATIONS); } @@ -130,6 +139,15 @@ public class ServerRpcHandler implements Serializable { return syncId; } + /** + * Checks if this is a request to resynchronize the client side + * + * @return true if this is a resynchronization request, false otherwise + */ + public boolean isResynchronize() { + return resynchronize; + } + /** * Gets the entire request in JSON format, as it was received from the * client. @@ -186,6 +204,10 @@ public class ServerRpcHandler implements Serializable { ui.getConnectorTracker().cleanConcurrentlyRemovedConnectorIds( rpcRequest.getSyncId()); + + if (rpcRequest.isResynchronize()) { + ui.getSession().getCommunicationManager().repaintAll(ui); + } } /** diff --git a/server/src/com/vaadin/server/communication/UidlRequestHandler.java b/server/src/com/vaadin/server/communication/UidlRequestHandler.java index 6e338c5773..33a3669b7f 100644 --- a/server/src/com/vaadin/server/communication/UidlRequestHandler.java +++ b/server/src/com/vaadin/server/communication/UidlRequestHandler.java @@ -80,10 +80,12 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements // repaint requested or session has timed out and new one is created boolean repaintAll; - // TODO PUSH repaintAll, analyzeLayouts should be + // TODO PUSH analyzeLayouts should be // part of the message payload to make the functionality transport // agnostic + // Resynchronize is sent in the payload but will still support the + // parameter also for compatibility reasons repaintAll = (request .getParameter(ApplicationConstants.URL_PARAMETER_REPAINT_ALL) != null); -- cgit v1.2.3