Thursday, July 7th, 2005

How DWR handles XML

Category: Java

Joe Walker, founder of DWR (Direct Web Remoting), discusses the X in Ajax, and how DWR handles it.

DWR works a bit like RMI except that instead of having 2 Java systems talking to each other using JRMP you have a web browser and a web server talking using AJAX/HTTP.

DWR marshalls all the Java and Javascript parameters over an AJAX HTTP call, but it always uses text/plain even when it is transferring XML. How does it do this?.

DWR generates Javascript for execution by the browser. For the example above the Javascript contains a text version of the XML document above. DWR arranges for it to be parsed using the browsers internal XML parser and then calls the appropriate callback to recieve the DOM tree.

This may seem like an overly complex way to do things but it means that you can pass around compound JavaBeans which contain a number of things including XML elements

Ajax: How DWR handles XML

Posted by Dion Almaer at 12:04 am
Comment here

+++--
3 rating from 5 votes

Comments Here »

Comments feed

Leave a comment

You must be logged in to post a comment.