On Fri, May 22, 2009 at 12:07 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
...
> The for latter, you might need to add a couple more annotations to help JAXB
> know what to do with the List.
>
> For such cases it might be better to stick with just JSON and use the direct
> object to JSON supported offered by Jackson, which supplies the message body
> writers and may support your case. Tatu would know more.
I was about to suggest that, since for non-JAXB json this should be a
trivial case to serialize and deserialize, since the impedance between
xml and json is not relevant.
Jackson version 1.0 (i.e. first official non-beta version) was just
released, and offers reasonable support for JAX-RS content
conversions.
This support can co-exist with JAXB for XML; and in most cases does
not need additional configuration or annotation since it has support
for standard types as well as bean introspection.
If you want to try it out, you just need to add
"jackson-jaxrs-[VERSION].jar" above and beyond 2 jackson jars (core,
mapper) already included (may want to upgrade those to 1.0.0 if so);
and then register org.codehaus.jackson.jaxrs.JacksonJsonProvider as
MessageBodyReader/Writer implementations (for example by returning it
from WebApplication as singleton).
Jackson-json can of course also be produced directly too (read from
InputStream, written to OutputStream). But provider approach offers
bit simpler handling.
-+ Tatu +-