Greetings AppEngine experts,
I am working on a standalone Java program that will interact with a Google AppEngine app that I am also working on. It does so using the XMPP chat protocol. On the client-side, I need to be able to "pack" a POJO (Plain Old Java Object) into an XML chat packet (the easy part), and pull it back out on the server-side (the hard part). I will try to explain in as much detail as possible.
On the client end, this is very easy with the Smack library:
To Set the Value:
To Get it Back:
Vector<Integer> v = (Vector<Integer>) packet.getProperty("TheInt
The reason the server-side is not as straightforward is that the JRE for AppEngine is limited to only classes on an approved WhiteList:
- Google's own XMPP package is much more limited than Smack. I can get the XML chat packet, but the package does not include a way to pull out an Object.
- Also, Easy-To-Use (i.e. one-line-only) XML utilities that I would normally use are not usable in this case because of AppEngine restrictions. I am limited to what's in that list.
The one-size-fits all approach of Smack suits us very well because we need to send a wide variety of types, many of which are custom types in an inheritance hierarchy. This very small part of the project has turned into a hangup because of AppEngine's restrictions. We want to avoid doing a SAX/DOM parsing "mini project" for something that should have only taken 1-2 lines of code. This is where I hope to tap your plentiful brains, Experts.
So my question is this:
Using Only classes in the Whitelist, what is the simplest (i.e. fewest lines) way to get a Java Object from inside an XML packet?
Here is the XML from the code above.
<message id="84HBN-5" to="firstname.lastname@example.org/SmackE87F5B47" from="email@example.com" type="error">
<body>Vector of Ints Test</body>