users@jersey.java.net

Jaxb/Json and XmlElementRef

From: Johannes Schneider <mailings_at_cedarsoft.com>
Date: Tue, 31 Aug 2010 11:53:36 +0200

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

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

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

iQEcBAEBAgAGBQJMfNEdAAoJEAytD9R7Qv6d37cH/1kWI/y6F/LKAAb+rlfnqYtI
Y7EXMIluZbtzdCRq9pEmFAwcLQpWtAEWTBCt9dZo5ukeS4NFuPer5UBvya3WA/K6
cOVHcVXLQBxv8SbZOJuO0EzjdgsVYLwRFsVb96QfwPRVzDKJsjFzcUHjJVVfxlzN
Pf/NBsD84WK0TdpargOjI3lIm9s/zc6/ysM7dLgSP9tJUuL+TfC+4GoabEfS40VV
PJzWzLQWvGnH4Zc3hAQSQ9CmZZRBEkUDBgLjplWMFL/gFvyfyXJ7ta3Sl+yIoEqI
tkoAknuyEKAiGp4YKODJmdr0CkeksQ5n3J3KunWHyavfMGFn3kwH812o6cFPkU4=
=g4JL
-----END PGP SIGNATURE-----