PDA

View Full Version : On (De)Serialization of JavaBean state in DHTML applications


bacchu_anjan
Aug 30th, 2004, 03:58 PM
QUESTION ON HESSIAN usage : The traffic between a client side of a DHTML application(lots(over 100) of javascript objects) and the server side Java application(say, based on Tomcat) is getting higher and higher.

We have a DHTML application(no applets) which serializes
Java Bean state to a JavaScript Object using Velocity and deserializes that on the browser using a Javascript based Deserializer. I was wondering if we could reduce the bandwidth usage by using HESSIAN ?
I saw that Spring has support for Hessian but Hessian being a "java 2 java" protocol, we cannot use this protocol for our "Javascript 2 Java" need.

How have you solved this bandwidth issue ?

Thank you,

BR,
~A

jstrachan
Aug 31st, 2004, 11:31 AM
Have you tried just sending XML over to the JavaScript and itersting over XML from the JavaScript side of things?

e.g.

http://activemq.codehaus.org/Streamlets

I'm not sure if there is a pure JavaScript Hessian library yet?

bacchu_anjan
Sep 1st, 2004, 05:07 PM
Hi James,

Thank you for the info. I went to the site and will evaluate if it makes a difference.

What we are currently doing is to serialize the Java Bean state into XML and deserialize the XML stream using Javascript in the Browser. This is what I referred to as HIGH TRAFFIC.

Do you know if Streamlets approach (because they use Native code (MSXML -- XmlHttp Object) would be faster over a javascript based deserialization ?

Thanks again,

BR,
~A

jstrachan
Sep 2nd, 2004, 03:26 AM
Which is the performance bottleneck for you - the javascript on the client side or generating the XML on the server side? You know the javascript can all run in the background and so is asynchronous?

FWIW Streamlets uses the XMLHttpRequest of the browser which is usually implemented in native code; but its probably doing very similar things in the browser to what you're doing right now if you're parsing the response into a DOM on the browser side. Maybe you're doing things synchronously which is causing the apparent slowness?

If you're using a browser & JavaScript, I don't know another way of doing it that can be any faster - parsing the DOM seems to be the fastest way to parse XML on JavaScript, so it sounds like you're suck on the client side unless you go to a rich client of some kind.