Thursday, June 15, 2006

hacking XMLEncoder for unsigned and network friendly applets

XMLEncoder is very handy to serialize javabeans without the burden of hard coding encoders and decoders. Unfortunately, the current Sun implementation doesn't work properly with unsigned applet (there are hacks if you are willing to pay for an applet certificate).

Especially using XMLEncoder in an unsigned applet is very likely to result in security exceptions and will run slow and without any background threading solution.

Indeed, the DefaultPersistenceDelegate used by XMLEncoder for common javabeans uses to kill the network by opening dozens of sockets because it looks up for beanInfo classes on the server code base for every type inside your bean.

Fortunately, I worked hard and dicovered a hack: use the following encoder instead of XMLEncoder (you may adapt it a bit to your own beans in order to avoid some more specific beanInfo lookups). It's currently used in the last JGraphpad Community Edition online diagram editor.

Also, to decode server side XML files in an applet using an usigned applet, we use AppletFriendlyXmlDecoder, an applet friendly derivative of XMLDecoder.

The full source of AppletFriendlyEncoder which extends XMLEncoder is to be found on the Visualmodeller wiki here:
http://wiki.visualmodeller.org/AppletFriendlyXmlEncoder

A demo of it can be found in JGraphpad Community Edition demowed online at Visualmodeller here:
http://wiki.visualmodeller.org

3 comments:

Anonymous said...

oh!this works!!! :p

Anonymous said...

replica bags online uae replica hermes b6d52b0w62 replica bags and shoes replica bags in london find out this here s4e68i3i35 louis vuitton replica bags neverfull you can look here o1e87v7a01 gucci replica bags best replica ysl bags z1n64n7c40

Anonymous said...

jordan 4
kevin durant shoes
off white hoodie
curry 9
hermes belt