aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-07-26 13:17:44 +0300
committerHenri Sara <henri.sara@gmail.com>2017-07-26 13:17:44 +0300
commitf38da154c1e6f5706c95e7bbc1468d47a0a65104 (patch)
tree054b5e3ea9491e5540a7233e49f334098c45aede /server
parenteee5d3a25891579a1b2013a101ca7d185bc174ac (diff)
downloadvaadin-framework-f38da154c1e6f5706c95e7bbc1468d47a0a65104.tar.gz
vaadin-framework-f38da154c1e6f5706c95e7bbc1468d47a0a65104.zip
Make JavaScriptExtension serializable (#9721)
Fixes #9705
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java
index 7e228bb7ca..7765764b47 100644
--- a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java
+++ b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java
@@ -72,12 +72,17 @@ public class JavaScriptCallbackHelper implements Serializable {
private void ensureRpc() {
if (javascriptCallbackRpc == null) {
- javascriptCallbackRpc = (String name, JsonArray arguments) -> {
- JavaScriptFunction callback = callbacks.get(name);
- try {
- callback.call(arguments);
- } catch (JsonException e) {
- throw new IllegalArgumentException(e);
+ // Note that javascriptCallbackRpc is not a lambda to make sure it
+ // can be serialized properly
+ javascriptCallbackRpc = new JavaScriptCallbackRpc() {
+ @Override
+ public void call(String name, JsonArray arguments) {
+ JavaScriptFunction callback = callbacks.get(name);
+ try {
+ callback.call(arguments);
+ } catch (JsonException e) {
+ throw new IllegalArgumentException(e);
+ }
}
};
connector.registerRpc(javascriptCallbackRpc);