Hi Dan > The documentation for setting the collectionWrapperMap via Spring was a > little light
It is very diplomatic :-) thanks for your post, I'll update the docs. Cheers, Sergey -----Original Message----- From: Dan Check [mailto:[email protected]] Sent: 14 October 2009 16:24 To: [email protected] Subject: Collection name handling using collectionWrapperMap in Spring (JAX-RS) Hi -- I've been using the collection wrapper that Sergey recently added. The documentation for setting the collectionWrapperMap via Spring was a little light, so I figured I'd send out my experience. The default collection wrapper works great for most of my objects, but I have a few service calls that return mixed collections of objects descended from abstract classes. The abstract classes don't have @XmlRootElement tags, which means that there's no collection name that attaches to them. As a result, they don't serialize correctly. The solution is to use the collectionWrapperMap to map to the class name to a collection wrapper name. In Spring, you do this by customizing the collectionWrapperMap on the element provider as follows: <!-- Configure JAXB Provider --> <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider"> <property name="collectionWrapperMap"> <map> <entry> <key><value>com.foo.bar.MyObject</value></key> <value>MyObjects</value> </entry> </map> </property> </bean> ... then, when configuring your jaxrs:server, register the jaxbProvider bean as a provider (<jaxrs:providers><ref id="jaxbProvider" /></jaxrs:providers>) Hope this helps folks out. Thanks for including this functionality, Sergey! Dan ----- CONFIDENTIALITY NOTICE: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or responsible for delivering it to the intended recipient, please be advised that any distribution, dissemination, copying or other transmission or use of the information contained in this message or its enclosed attachments is strictly prohibited. Please notify us immediately if you have received this message in error by replying to the sender of the message and deleting it from your computer. Thank you.
