users@jersey.java.net

Re: [Jersey] Unable to serialize (JAXB) when returning Response instead of actual object types

From: Craig McClanahan <Craig.McClanahan_at_Sun.COM>
Date: Fri, 14 Nov 2008 14:00:39 -0800

Jeremy Whitlock wrote:
>> I'll bet you are running into an "interesting" detail about JAXB that
>> also bit me.
>>
>> I generate my JAXB classes from a schema with embedded JAXB annotation
>> stuff, and (to make a long story short), JAXB does *not* generate a
>> @XmlRootElement annotiation (I *think* that's the right one). Without
>> this annotation, JAXB has no way to know what "outer" element to use
>> around your list.
>>
>
> But I have that annotation on my objects. With the @XmlRootElement
> annotation on a class, JAXB should be able to do this but it has
> problems. That is of course unless I misunderstand what you're saying.
>
>
If you have @XmlRootElement already, I would expect a method that
returns a single Person to work correctly. That doesn't necessarily
help on returning a list.

As I haven't ever actually had that combination (model class with
@XmlRootElement, resource method returning a list of that model class),
I'll have to do some digging ... I vaguely recall reading about this
scenario in earlier message threads of this mailing list, but don't have
the details at the tip of my tongue.

Craig

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