Hi Lars
On 28/11/12 07:43, Lars Beiderbecke wrote:
Hello,

Yes, a workaround for non-Spring scenarios would be most helpful.

Also note that having to include every single array in a separate file
such as cxf.xml isn't really a workaround, it's more like an ugly
kludge (no offense). Have there been thoughts about a proper solution?

I won't pretend and say it is actually a super way to manage this issue :-), but I've no idea how to fix it at the Jettison level such that no custom configuration is requested.

Actually, spotted
http://jackson-users.ning.com/forum/topics/support-for-jettison-s-broken-array-serialization

Jackson does it right all the time, but can optionally be configured to unwrap a single element array...I suspect there might be few clients out there who depend on this Jettison specific treatment of a single array element.

As far as I understand, Jettison can not auto-determine in principle, by the time it starts to serialize, whether a key with a single value represents a simple or list property given that it has no access to the type info. I wonder if Jackson introspects the bean which is serialized - seems like the only way to do it right...

This is why 'arrayKey' property is needed.

Have a look at Jettison code please too. As I said - I'm not sure this can be fixed correctly at the custom writer implementation level without any type info, but may be some other 'hint' my help, I don't know, say, a simple property can never appear where an array/list property is supposed to appear, if something like that is possible to assert then Jettison can always know when to use an array serilaization for a key with a single value only. Whether it is realistic I do not know...

Cheers. Sergey

I found bug report<https://issues.apache.org/jira/browse/CXF-2820>,
which has been closed as WON'T FIX.

Lars


On Tue, Nov 27, 2012 at 4:36 PM, Sergey Beryozkin<[email protected]>  wrote:
Hi

On 27/11/12 15:30, Ladislav Lenčucha wrote:

Have you checked

http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml?

Could you attach all relevant parts of your cxf.xml? That includes e.g.
<jaxr:server>. Also attach the object that contains array/collection. Are
the collection items annotated as myArray1 or myArray2?

Unfortunately, given that non-Spring servlet is used, this spring config
won't be used...And it is only possible to list simple parameters, as
opposed to the list parameters, for specific providers...

I'll check if a list parameter can be supported easily enough...

Sergey


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to