[JDEV] Sending a packet with an object - using JabberBeans

Matt Tucker matt at jivesoftware.com
Fri Dec 6 15:21:32 CST 2002


Adrian,

You have a few options, I think. If you're using JDK 1.4, you could try
the new XML serialization for Java beans technology that's part of that
release. Check out:

http://java.sun.com/j2se/1.4/docs/api/java/beans/XMLEncoder.html 

and related classes. Using that technology, you're not really
"searilizing" the object in the traditional sense, but are using an XML
format for the object state. There are also third party technologies for
doing XML serialization such as:

http://www.wutka.com/jox.html (I'm sure you can find others).

Once you have the XML data, just add it to the message in an <x> field.

Otherwise, if you need to do normal serialization, I'd recommend doing
something like text encoding the serialization output stream and
attaching that as a huge chunk of text data to a jabber message. I'm
fairly certain there are utility classes that you can use to do this as
part of Javamail.

Regards,
Matt

> -----Original Message-----
> From: jdev-admin at jabber.org [mailto:jdev-admin at jabber.org] On 
> Behalf Of Adrian Brown
> Sent: Friday, December 06, 2002 3:55 PM
> To: jdev at jabber.org
> Subject: [JDEV] Sending a packet with an object - using JabberBeans
> 
> 
> Does anyone know how I can add a serialized object to a packet 
> (preferably <message>) I'm using the JabberBeans library?
> 
> Thanks
> 
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mailman.jabber.org/listinfo/jdev
> 




More information about the JDev mailing list