Whoops...
Just noticed this:
https://jersey.dev.java.net/issues/show_bug.cgi?id=18
I will try out creating a Collection wrapper.
Sorry for the noise...
Tyson
________________________________
From: Tyson Norris
Sent: Friday, August 15, 2008 2:49 PM
To: 'users_at_jersey.dev.java.net'
Subject: RE: JAXB/JSON Array reading problem (Array writing is OK)
Some additional info I forgot to mention:
- version: I'm using 0.8ea version of Jersey
- my collection elements are getting created properly, and the
collection is read from the converter (by JAXB unmarshaller) but the
collection is never assigned to the converter property.
I will try a similar test with XML data and see what happens...
Tyson
________________________________
From: Tyson Norris
Sent: Friday, August 15, 2008 2:31 PM
To: 'users_at_jersey.dev.java.net'
Subject: JAXB/JSON Array reading problem (Array writing is OK)
Hi -
I am trying to send JSON data into a jersey service using HTTP POST.
This works, in general, for me, except one JAXB property is type
Collection, and JAXB does not seem to unmarshall the collection; the
collection value (on the JAXB converter) is always null, and the setter
is never called.
For example, I am sending something like:
{"myObj":{"prop1" : "value1", "prop2" : "value2", "collectionValues" :
[{"itemProp1" : itemvalue1", "itemProp2":"itemValue2"}]}}
My JAXB converter is created properly, and non-collection property
values are assigned (i.e. I see that getProp1() returns "value1", etc),
but: setCollectionValues() is never invoked, and therefore my collection
values are not available in the JAXB object.
When I use the same JAXB Object to return data in JSON format, the
collectionValues are properly marshaled to the same JSON format listed
here.
I have tried changing the type of collection in the
getCollectionValues/setCollectionValues methods from
java.util.Collection<ItemPropConverter> to
java.util.List<ItemPropConverter>, but I get the same results
(collection is never set when sending data in, data is properly
translated to JSON when sending data out).
Any ideas what might cause this?
Thanks!
Tyson