Javascript communication and JSObjects
Matthieu BROUILLARD
matthieu at brouillard.fr
Sat Apr 28 07:12:17 PDT 2012
Hello the community,
I am integrating a webapp (GWT one) into a JavaFX app, this was made quite
easy following the hints given in the documentation [1] or the JavaFX blog
[2].
I want now to go a step further and have simplified the following examples
to explain my pains.
Let's say my webapp handles simplified Person objects created in JS
using : {"name"="Matthieu",
age=30}
I have an interface HelloPerson with a simple method hello().
>From the JS side, after installing my Java implementation from the java
side, I am able to call: window.helloService.hello(aPersonObject);
If I install on the javaside an implementation of the following interfaces:
- HelloService hello(Object o), then it works I receive a non null
object that I can cast to JSObject and access the member attributes name &
age.
- HelloService hello(JSObject o), then the method is called but the
given parameter is null
What's going wrong there?
Also I would like my API to be cleaner and strongly type. Does someone has
hints/idea how I could plug an interface like HelloService
hello(Person p)where Person would be JAXB annotated for example (or
just following
JavaBean spec).
Are there hooks available on the webengine where I could plug to
intercept/transform the calls?
Thanks for reading.
[1] http://docs.oracle.com/javafx/2/webview/jfxpub-webview.htm
[2]
https://blogs.oracle.com/javafx/entry/communicating_between_javascript_and_javafx
More information about the openjfx-dev
mailing list