On 10/12/13 18:25, Sergey Beryozkin wrote:
This actually works, it should be
>> -d '{"cmd":{"obj1": []}}'
Well, in my test I had a bean with the initialized List, so I had it
working. I've spent nearly a day today on Jettison properly reporting
start and end element events for the empty arrays and ended up seeing
the CXF tests failing due to JAXB, inexplicably, creating a single
uninitialized bean and injecting it into the array, I had the same
confirmed with XML, example, if you have
"<a><b/></a>"
and A bean having a List of Book and named as 'b' then this List<Book>
will have an uninitialized Book added to it.
Similar issue is discussed at
http://stackoverflow.com/questions/4181120/transforming-empty-element-into-null-when-unmarshalling-with-jaxb
Basically, we have to keep the current Jettison reporting of events as is...
Cheers, Sergey
Does not work well on the write side though, can't produce an absolutely
empty [], but will be possible in Jettison 1.3.5
Sergey
On 14/10/13 10:38, Sergey Beryozkin wrote:
Hi
On 11/10/13 20:52, David Hay wrote:
I'm trying to pass in an empty array as a JSON parameter, but it
seems to
come through as null.
I'm trying:
-d '{"cmd":{"obj1": "[]"}}'
where cmd is an object Cmd which has Obj1[ ]
Is there a way to do this in CXF?
I'm not sure it is possible at the moment, I suspect Jettison would need
to be updated to issue startElement and endElement events for "obj1" for
JAXB to initialize a list/array. Try JacksonJsonProvider, may it can
handle it
Sergey
cheers,
David
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com