...
- To serialize extensions to XML, the extension's field name must be predefined in the parent POJO. For example, to properly serialize the 'extensions' bucket in the Introduction example, the 'extension' property must be hardcoded in ActivityEntry.java (and the implementing class). Fortunately, once the property is added, nested extensions within the bucket are supported to an arbitrary depth.
- Very limited XML POST support. This has been a longstanding limitation of Shindig. Only the most basic XML POST requests succeed (only string key/value pairs, no Lists or Maps).
- Serialization of extensions do not follow all OpenSocial conventions. The following illustrates the serialization of a JSON extension which includes simple string key/value pairs, a list of strings, and a list of objects: <JSON & XML here>Very limited XML POST support. This has been a longstanding limitation of Shindig. Only the most basic XML POST requests succeed (only string key/value pairs, no Lists or Maps).
Code Block |
---|
--- JSON SERIALIZATION ---
extension: {
key1: "value1",
key2: "value2", stringList: [
"element1",
"element2",
"element3"
],
mapList: [
{
key1: "value1"
},
{
key2: "value2"
}
]
}
--- XML SERIALIZATION ---
<extensions>
<key1>value1</key1> <key2>value2</key2>
<stringList>
<java.lang.String>element1</java.lang.String>
<java.lang.String>element2</java.lang.String>
<java.lang.String>element3</java.lang.String>
</stringList> <mapList>
<map>
<entry>
<key>key1</key>
<value>value1</value>
</entry>
</map>
<map>
<entry>
<key>key2</key>
<value>value2</value>
</entry>
</map>
</mapList>
</extensions>
|
How It's Implemented
Here are some technical details of how I implemented support for arbitrary extensions in Shindig. It should come in helpful if anyone needs to expand or modify this work.