users@jersey.java.net

Re: [Jersey] JAXBContext and Resolvers

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 28 Aug 2009 13:27:10 +0200

On Aug 28, 2009, at 1:11 PM, David Sells wrote:

> Hi Paul,
>
> My apologies on this question as I'm barking up the wrong tree. The
> problem with the
> Provider not being incorporated into the application was was
> resolved by defining it
> as a bean in the applicationContext (@Component didn't cut it).

I am guessing you are not using autowiring? and have something like
the following in your Spring config:

<context:component-scan base-package="<my package>"/>

?


> I
> need to do some more reading on the whole marshalling strategy. The
> type
> erasure issue with collection and JAXB raises some ease-of-use issues.
>

Yes, it is a PITA.

If say the return type of a resource method is List<MyJAXBBean> it
will work fine. However if you add an entity instance when building a
Response you need to use GenericEntity:

   https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/core/GenericEntity.html

Paul.