RemoteObject in BlazeDS environment: Serializing objects from JAXB/XJC-generated classes
I'm developing a webapp with Java backend and Flash (pure ActionS开发者_如何学Gocript) frontend using BlazeDS.
I'm using the RemoteObject stuff to send objects, using custom serialization, where I need to implement Externalizable (Java) and IExternalizable (AS) interfaces. This works fine so far.
But now I need to send objects from Java to Flash, whose classes are generated with JAXB/XJC. Of course these generated Java classes don't implement the Externalizable interface, so it seems that I can't use my approach here.
One possibility seems to be writing a XJC plugin which makes the classes implement Externalizable. But this looks like a tough job...
Does anyone have a good idea how to solve this problem?
A couple of options:
- build a set of objects on top of your JAXB generated classes. I would choose this option.
- build a proxy on top of your JAXB generated classes which will serialize/deserialize accordingly each object. If your objects are implementing the Externalizable interface you can use the Dynamic Proxy API from Java, no need for dynamic code generation
- modify the blazeds distribution. I would stay away from it, but it is doable.
I finally developed a JAXB/XJC plugin. (If someone's interested, just contact me.) Works fine now.
精彩评论