users@jersey.java.net

Re: [Jersey] Jaxb/Json and XmlElementRef

From: Johannes Schneider <mailings_at_cedarsoft.com>
Date: Thu, 02 Sep 2010 10:36:29 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/01/2010 11:51 AM, Paul Sandoz wrote:
> Hi Johannes,
>
> I am guessing there are some underlying constraints with the default,
> mapped or badgerFish configuration. Jakub, who is currently on holiday,
> may know more.
>
> To switch to the natural convention see here:
>
>
> https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html#d4e815

This is not exactly the best option. I would have to implement too much
to get it working.
I think some kind of option to configure the default convention globally
would be great...


Thanks,

Johannes

>
> Paul.
>
> On Aug 31, 2010, at 11:53 AM, Johannes Schneider wrote:
>
> Hi guys,
>
> I don't know whether this is the right list to ask (probably not)... But
> since Jersey provides the glue code...
>
> I have a XML root element with that declaration:
>
> @XmlElementRef
> private List<Stub> users;
>
>
> The XML looks fine - just as I expected.
> Serializing this to JSON:
>
> {"user":[
> {
> ....
>
>
> Well, the "user" isn't too nice (I think this is the name as added to
> the XmlType of the bean contained into the list)
>
> The problem is, that unmarshalling does *not* work. the collection is
> null...
>
>
> I tried to investigate the problem and found out that:
>
> - Unmarshalling only works as expected with "natural" as configuration:
>
> JSONJAXBContext context = new JSONJAXBContext(
> JSONConfiguration.natural().build(),..)
> JSONMarshaller marshaller = context.createJSONMarshaller();
>
> - It does *not* work with the default, mapped or badgerFish
> configuration.
>
>
> So could anybody give me a hint, what my problem is? Or is this a
> missing feature from the underlying JSON library?
> How can I configure the JSON configuration with Jetty? So that I could
> simply switch to natural...
>
>
>
> Thanks,
>
> Johannes
>
>>
- ---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net


- --
Johannes Schneider - blog.cedarsoft.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJMf2IKAAoJEAytD9R7Qv6d8IMIAMJ3uADcOEB4Px47ylq9xh9O
DnJSahfD6k1/aoULKbvEe/JBL0p+J5f94FFKB/PO3mHla4U7YWM3y6urfSY9k/4N
f+Xzi9X5vbTULSS18r/OY+tWRpA0sJIFGT8xzCZxNydN3do21K/k4S/6PMTpdLpa
d6y4Rdi5bKX8SiYj5B5+synsehy8d15pFi6yFEyTdMSDEQb2KxmUWMOUj0H7aeNG
ZdEXmQ6tYB+EeTXhXqk7BWbTCnr7/w/li5aqBKAkHh0szkEmoT8Itzv+9yR0i8qV
LYk0CruCW9rMtiTevsVyM6f7G6J1j/31baAF5fzTBL+O3HknMMLsklAi4qSz2Ek=
=rPeP
-----END PGP SIGNATURE-----