BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Interview: Joe Walker discusses DWR

Interview: Joe Walker discusses DWR

Bookmarks

Direct Web Remoting (DWR) is a AJAX library which allows JavaScript in a browser to interact directly with Java code on a server. InfoQ spoke with Joe Walker at QCon London 2007 about the DWR toolkit. Walker discussed DWR 2.0 including new features such as details about reverse AJAX, the deal with TIBCO, DWR support in IDEs, the integration with Spring, future plans for DWR, and interesting applications of DWR from the very large to the very flashy.

Watch Joe Walker discusses DWR (14 minutes).

From the interview:

Basically what DWR does is, it's a way of taking Java classes and making them easily usable from JavaScript. You take a Java class, you say to DWR "we would like to export this" and DWR will create you some stubs so you can call it from JavaScript - it'll do all the marshalling and that sort of stuff. The idea is pretty much any Java method, you can call that from JavaScript, and it will marshal pretty much anything, so all sorts of collections of maps, strings, integers, even things like DOM models will come across onto the browser for you to use there.

On DWR 2.0's new 'reverse AJAX' feature:

The idea is that you will be able asynchronously on a server to push commands out to the browser. So it very simply enables you to say, "get me all of the browsers on this page" or "give me this particular browser", and then say "I would like all these browsers, or that browser, to do this thing - here is a command for them" -- that is the basic here, really. I guess the next step on from that is we have got a set of APIs in Java that mimic APIs in JavaScript -- the initial one at the moment is the script.aculo.us effects API as well as the DWR DHTML manipulation library.

It enables you to do things like, the obvious example everyone uses is the chat application. When somebody types something in on a message box you can say, "get me all the other browsers looking at this page and add this message to the list." and there's a Java API to let you do that page manipulation and it will automatically convert all the primitives from Java types into JavaScript types and pass that out to all the browsers looking at that page. So all of the browsers will dynamically change with a single Java command, which is quite nice.

Rate this Article

Adoption
Style

BT