Interaction between web and desktop application

Browser component in Eclipse RCP application offers the possibility to mix web and desktop applications. There’s a lot of advantages of this technic, in particular when it concern a reuse of an existing web application. One of the interest is to never be dependant of the browser but you’re application is the browser.
To make this working it’s necessary to communicate between web and desktop. This article suggest 6 solutions…

Browser component in Eclipse RCP application offers the possibility to mix web and desktop applications. There’s a lot of advantages of this, in particular when it concern reuse of an existing web application. One of the interest is to never be dependant of the browser but to make your application become the browser.
To make this working it’s necessary to communicate between web and desktop, it’s relatively easy to send data to browser by using (setURL()) or by executing Javascript (execute()). But for sending data to the desktop it’s more difficult. I suggest 6 solutions to do that :
1. via the status bar : like it show on the SWT snippets site (Snippet160)
2. via the address bar: like Peter Nehrer say
3. directly request HTML DOM : by using Mozilla Browser (new in 3.3) with the XPCOM library. A little example using the Snippet267 and modify it to use XPath and catch a title of an input field. There’s a lot of possibility with this API like ATF do (maybe i have to take time to make an article about the possibility offers by XPCOM).


4. via a socket : by executing an XMLHTTPRequest with execute() method which call a socket and get the content.

5. running an HTTP server inside the Eclipse JVM : with Tomcat embedded for example or with WebObjects (Application.primeApplication()). The objects in the same JVM can be shared but be carreful of classloaders.
6. via terracota : a JVM cluster offer an easy way to synchronize objects between JVM.