users@jersey.java.net

[Jersey] Re: JSONConfiguration.FEATURE_POJO_MAPPING

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Tue, 15 Feb 2011 15:17:52 -0800

On Tue, Feb 15, 2011 at 6:33 AM, Pavel Bucek <pavel.bucek_at_oracle.com> wrote:
> Hello Gili,
>
> no, its not enabled by default, you have to explicitly set it to true.
>
> When FEATURE_POJO_MAPPING is disabled, jersey-json module is used for
> serializing/deserializing to/from json. This implementation is based on JAXB
> (Jakub can add more info if you need, he is the author).

One other thing that might be helpful: before Jackson 1.0.0 was
released, there was lots of discussion as to whether to include file
"META-INF/service/javax.ws.rs.ext.MessageBodyReader" (and -Writer) in
jackson-jaxrs jar, to "auto-wire" it as the default provider. This
would make it all automatic; if jar is found, it will be registered as
the default conversion provider for JSON content.

We decided against doing that, due to fears that then default settings
would be overridden; especially as transitive
dependencies sometimes bring in stuff one is not aware of.
Other discussed alternative was that of building 2 jars (one with, one
without), but that seemed complicated from Maven dependency
perspective. So we thought one-line registration would be lesser of
evils.
It could be time to re-visit this decision, but I guess that
discussion would be better on jackson-users list.

However: if you wanted to, it'd be easy to re-package jackson-jaxrs
jar; one line manifest files are still in Jackson source repo, under
"src/jaxrs/resources" (and build-osgi.xml has one line change that
would stick it in there).

-+ Tatu +-

ps. You actually don't have to repackage Jackson jars -- I think all
you need is a jar that has these 2 one-line files in right places, and
auto-registration would work. In fact, such bogus jar might be useful
for others.