Twitter

From APIDesign

Jump to: navigation, search

Follow me at @JaroslavTulach. In case you are interested in Bck2Brwsr project, read on.

Twitter Client Demo

Update May 17, 2015: the Twitter demo has been resurrected by Toni: See https://dukescript.com/best/practices/2015/05/17/twitter-demo.html

Update Jan 13, 2014: the Twitter demo has been removed, as it does not work since Twitter changed its internal protocol. But one can try for example the chess demo:

In case you are curious how the above has been achieved and you are willing to spend few more minutes with the project, here are steps to get the Java to your browser as well:

$ hg clone https://hg.java.net/hg/html~demo
$ cd html~demo/chess/
$ mvn install bck2brwsr:brwsr

If everything goes well you should see JavaFX's WebView component (if you have JDK7 with JavaFX) showing tweets from famous tweeters (if your JDK knows how to pass through your HTTP proxy).

C'mon: That is not my Browser!

If you got that far, you may properly object that the above is far from bringing Java Bck2Brwsr. You'd be right! The above mode is called FXBrwsr (and it is useful as well, for example for debugging). However the real beauty (and major achievement of release 0.7 of the Bck2Brwsr project) is that the same code can easily be re-packaged and executed in the browser. Just type:

$ mvn -Pbck2brwsr install bck2brwsr:brwsr

and you'll see the same application running in your default system browser.

Single API - Dual (or more) Deployment

How can the same code run in HotSpot as well as Bck2Brwsr VMs? Is the Bck2Brwsr VM so good? Does it really mimic the standard Java VM that closely?

Well, it does not. There are differences in Java to JavaScript calling conventions (see Bck2BrwsrMangling) as well as in the way one executes JavaScript bindings in JavaFX's WebView and real browser. As such the compatibility between the two modes is achieved by having single ClientAPI and multiple its implementations. See JSON4Brwsr page for details.

Personal tools