You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by Jesse A Ramos <jr...@us.ibm.com> on 2010/09/21 17:59:27 UTC

Making Jackson the default JSON provider

In reference to WINK-299: https://issues.apache.org/jira/browse/WINK-299

Hi,

As mentioned in WINK-299, Jackson seems to be the best available JSON 
provider.  It would be good to make this default for WINK.  I don't mind 
making the change but wanted to get some opinions on a couple of things.

1) Does everyone agree that Jackson should be the default JSON provider?
2) If so, what default configuration settings should we use?

For question 2, Jason provided a code snippet for what he is using in 
WINK-299.  It likes good to me as a default configuration.  If others 
agree I can use that, otherwise let me know what other configuration 
settings you would like to use.

Thanks,
Jesse

Re: Making Jackson the default JSON provider

Posted by Jesse A Ramos <jr...@us.ibm.com>.
 Well that didn't come out right =).

I put the same comment into Wink-299 where the formatting is correct.
 
-- Jesse
 
-----Jesse A Ramos/Austin/IBM@IBMUS wrote: -----

To: wink-dev@incubator.apache.org
From: Jesse A Ramos/Austin/IBM@IBMUS
Date: 09/23/2010 12:53PM
Subject: Re: Making Jackson the default JSON provider

After fiddling with things a 
bit I found that taking all the defaults for the JacksonJaxbJsonProvider
&nbsp;results in null properties being marshaled into the resulting JSON for 
JAXB Objects.&nbsp; I think we should suppress these from being written.

Looking
&nbsp;at our unit tests, I see we do the following:
<code>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;JacksonJaxbJsonProvider jacksonProvider = new 
JacksonJaxbJsonProvider();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
jacksonProvider.configure(Feature.WRITE_NULL_PROPERTIES, Boolean.FALSE);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;return new Object[] {jacksonProvider};
</code>

However,
&nbsp;Feature.WRITE_NULL_PROPERTIES is deprecated.&nbsp; It looks like using this 
code instead, we achieve the same thing:
<code>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
JacksonJaxbJsonProvider jacksonProvider = new JacksonJaxbJsonProvider();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;ObjectMapper mapper = new ObjectMapper();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mapper.getSerializationConfig().setSerializationInclusion(Inclusion.NON_NULL);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;AnnotationIntrospector pair =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new 
AnnotationIntrospector.Pair(new JaxbAnnotationIntrospector(),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;new JacksonAnnotationIntrospector());
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;mapper.getSerializationConfig().setAnnotationIntrospector(pair);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;jacksonProvider.setMapper(mapper);
</code>

I'm planning
&nbsp;to check in a WinkJacksonJaxbJsonProvider that uses this 
configuration.&nbsp; Thoughts?

-- Jesse &nbsp;
-----Mike Rheinheimer <ro...@apache.org> wrote: -----

To: wink-dev@incubator.apache.org
From: Mike Rheinheimer <ro...@apache.org>
Date: 09/21/2010 02:48PM
Subject: Re: Making Jackson the default JSON provider

Yeah, Jesse's right. &nbsp;JacksonJsonProvider and JacksonJaxbJsonProvider both
support Jackson annotations. &nbsp;The JacksonJaxbJsonProvider adds support for
JAXB annotations. &nbsp;I love that my prior incorrectness will live on forever
in infamy!

:)
Thanks.
mike

On Tue, Sep 21, 2010 at 2:39 PM, Jesse A Ramos <jr...@us.ibm.com> wrote:

> &nbsp;+1
>
> The doc seems to indicate that JacksonJaxbJsonProvider has the same
> functionality as JacksonJsonProvider except that it adds the JAXB support.
> JacksonJaxbJsonProvider extends JacksonJsonProvider.
> - Jesse
>
> -----Mike Rheinheimer <ro...@apache.org> wrote: -----
>
> To: wink-dev@incubator.apache.org
> From: Mike Rheinheimer <ro...@apache.org>
> Date: 09/21/2010 02:20PM
> Subject: Re: Making Jackson the default JSON provider
>
> Yup, Jason, you make a good point. &nbsp;If an app developer wishes to use
> Jackson-specific annotations, they must use JacksonJaxbJsonProvider, so
> let's be sure to make that the Wink default, not JacksonJsonProvider, if we
> intend to allow for that. &nbsp;If we don't, then Wink app developers would
> have
> to declare JacksonJaxbJsonProvider themselves in their Application subclass
> getClasses method.
>
> I'm ok with making JacksonJaxbJsonProvider the Wink default, thereby
> allowing Jackson-specific annotations out-of-the-box. &nbsp;Any other
> opinions?
>
> mike
>
>
> On Tue, Sep 21, 2010 at 1:45 PM, Jason Dillon <ja...@planet57.com> wrote:
>
> > The short answer is... I don't know ;-) &nbsp;It does look like the
> latest 1.6
> > JacksonJaxbJsonProvider should work fine as-is. &nbsp;I've just updated
> my app to
> > configure a JacksonJaxbJsonProvider.class via getClasses() and it seems
> > happy enough.
> >
> > I do use the jaxb+json provider here because I am using some jackson
> > specific annotations, specifically @JsonTypeInfo, to enrich the json data
> > slightly in some cases. &nbsp;This helps bridge the gap between xml &
> json wrt
> > lists of heterogeneous data. &nbsp;Xml worked due to the additional
> namespaces
> > introduced, json didn't w/o a little bit of help from jackson.
> >
> > --jason
> >
> >
> > On Sep 21, 2010, at 9:44 AM, Jesse A Ramos wrote:
> >
> > > Thanks Mike,
> > >
> > > Your question was going to be my next one =). Didn't want to convolute
> > the original query.
> > >
> > > I took a look at the Jackson javadoc but didn't find anything that said
> > what the defaults were. &nbsp;It seemed to me, based on the functionality
> of
> > JacksonJaxbJsonProvider and JacksonJsonProvider, that the defaults were
> > likely the same but I wasn't sure.
> > >
> > > - Jesse
> > >
> > > -----Mike Rheinheimer <ro...@apache.org> wrote: -----
> > >
> > > To: wink-dev@incubator.apache.org
> > > From: Mike Rheinheimer <ro...@apache.org>
> > > Date: 09/21/2010 11:30AM
> > > Subject: Re: Making Jackson the default JSON provider
> > >
> > > +1 to making Jackson the default JSON provider. &nbsp;Most other JAX-RS
> impls
> > use
> > > it as their default AFAIK, Jackson is a quite active community, and the
> > main
> > > dev lead over there (Tatu Saloranta) was the main developer on Woodstox
> > STAX
> > > parser. &nbsp;It's a very high quality project.
> > >
> > > Looking at WINK-299, I'm not sure what Jason has that Jackson does not
> > > already provide by default. &nbsp;The JacksonJsonProvider, which is the
> base
> > > class for JacksonJaxbJsonProvider, already has all of what's shown in
> 299
> > as
> > > its defaults:
> > >
> > >
> >
> http://svn.jackson.codehaus.org/browse/jackson/trunk/src/jaxrs/java/org/codehaus/jackson/jaxrs/JacksonJsonProvider.java?r=HEAD
> > > (see locateMapper method, line 565)
> > >
> > > Jason, is the explicit mapper instantiation still required, per your
> code
> > > snippet in WINK-299?
> > >
> > > mike
> > >
> > >
> > > On Tue, Sep 21, 2010 at 10:59 AM, Jesse A Ramos <jr...@us.ibm.com>
> > wrote:
> > >
> > >> In reference to WINK-299:
> > https://issues.apache.org/jira/browse/WINK-299
> > >>
> > >> Hi,
> > >>
> > >> As mentioned in WINK-299, Jackson seems to be the best available JSON
> > >> provider. &nbsp;It would be good to make this default for WINK.
> &nbsp;I don't mind
> > >> making the change but wanted to get some opinions on a couple of
> things.
> > >>
> > >> 1) Does everyone agree that Jackson should be the default JSON
> provider?
> > >> 2) If so, what default configuration settings should we use?
> > >>
> > >> For question 2, Jason provided a code snippet for what he is using in
> > >> WINK-299. &nbsp;It likes good to me as a default configuration.
> &nbsp;If others
> > >> agree I can use that, otherwise let me know what other configuration
> > >> settings you would like to use.
> > >>
> > >> Thanks,
> > >> Jesse
> > >
> >
> >
>
>



Re: Making Jackson the default JSON provider

Posted by Jesse A Ramos <jr...@us.ibm.com>.
After fiddling with things a 
bit I found that taking all the defaults for the JacksonJaxbJsonProvider
 results in null properties being marshaled into the resulting JSON for 
JAXB Objects.&nbsp; I think we should suppress these from being written.

Looking
 at our unit tests, I see we do the following:
<code>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 JacksonJaxbJsonProvider jacksonProvider = new 
JacksonJaxbJsonProvider();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
jacksonProvider.configure(Feature.WRITE_NULL_PROPERTIES, Boolean.FALSE);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 return new Object[] {jacksonProvider};
</code>

However,
 Feature.WRITE_NULL_PROPERTIES is deprecated.&nbsp; It looks like using this 
code instead, we achieve the same thing:
<code>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
JacksonJaxbJsonProvider jacksonProvider = new JacksonJaxbJsonProvider();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 ObjectMapper mapper = new ObjectMapper();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mapper.getSerializationConfig().setSerializationInclusion(Inclusion.NON_NULL);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 AnnotationIntrospector pair =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new 
AnnotationIntrospector.Pair(new JaxbAnnotationIntrospector(),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 new JacksonAnnotationIntrospector());
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 mapper.getSerializationConfig().setAnnotationIntrospector(pair);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 jacksonProvider.setMapper(mapper);
</code>

I'm planning
 to check in a WinkJacksonJaxbJsonProvider that uses this 
configuration.&nbsp; Thoughts?

-- Jesse  
-----Mike Rheinheimer <ro...@apache.org> wrote: -----

To: wink-dev@incubator.apache.org
From: Mike Rheinheimer <ro...@apache.org>
Date: 09/21/2010 02:48PM
Subject: Re: Making Jackson the default JSON provider

Yeah, Jesse's right. &nbsp;JacksonJsonProvider and JacksonJaxbJsonProvider both
support Jackson annotations. &nbsp;The JacksonJaxbJsonProvider adds support for
JAXB annotations. &nbsp;I love that my prior incorrectness will live on forever
in infamy!

:)
Thanks.
mike

On Tue, Sep 21, 2010 at 2:39 PM, Jesse A Ramos <jr...@us.ibm.com> wrote:

> &nbsp;+1
>
> The doc seems to indicate that JacksonJaxbJsonProvider has the same
> functionality as JacksonJsonProvider except that it adds the JAXB support.
> JacksonJaxbJsonProvider extends JacksonJsonProvider.
> - Jesse
>
> -----Mike Rheinheimer <ro...@apache.org> wrote: -----
>
> To: wink-dev@incubator.apache.org
> From: Mike Rheinheimer <ro...@apache.org>
> Date: 09/21/2010 02:20PM
> Subject: Re: Making Jackson the default JSON provider
>
> Yup, Jason, you make a good point. &nbsp;If an app developer wishes to use
> Jackson-specific annotations, they must use JacksonJaxbJsonProvider, so
> let's be sure to make that the Wink default, not JacksonJsonProvider, if we
> intend to allow for that. &nbsp;If we don't, then Wink app developers would
> have
> to declare JacksonJaxbJsonProvider themselves in their Application subclass
> getClasses method.
>
> I'm ok with making JacksonJaxbJsonProvider the Wink default, thereby
> allowing Jackson-specific annotations out-of-the-box. &nbsp;Any other
> opinions?
>
> mike
>
>
> On Tue, Sep 21, 2010 at 1:45 PM, Jason Dillon <ja...@planet57.com> wrote:
>
> > The short answer is... I don't know ;-) &nbsp;It does look like the
> latest 1.6
> > JacksonJaxbJsonProvider should work fine as-is. &nbsp;I've just updated
> my app to
> > configure a JacksonJaxbJsonProvider.class via getClasses() and it seems
> > happy enough.
> >
> > I do use the jaxb+json provider here because I am using some jackson
> > specific annotations, specifically @JsonTypeInfo, to enrich the json data
> > slightly in some cases. &nbsp;This helps bridge the gap between xml &
> json wrt
> > lists of heterogeneous data. &nbsp;Xml worked due to the additional
> namespaces
> > introduced, json didn't w/o a little bit of help from jackson.
> >
> > --jason
> >
> >
> > On Sep 21, 2010, at 9:44 AM, Jesse A Ramos wrote:
> >
> > > Thanks Mike,
> > >
> > > Your question was going to be my next one =). Didn't want to convolute
> > the original query.
> > >
> > > I took a look at the Jackson javadoc but didn't find anything that said
> > what the defaults were. &nbsp;It seemed to me, based on the functionality
> of
> > JacksonJaxbJsonProvider and JacksonJsonProvider, that the defaults were
> > likely the same but I wasn't sure.
> > >
> > > - Jesse
> > >
> > > -----Mike Rheinheimer <ro...@apache.org> wrote: -----
> > >
> > > To: wink-dev@incubator.apache.org
> > > From: Mike Rheinheimer <ro...@apache.org>
> > > Date: 09/21/2010 11:30AM
> > > Subject: Re: Making Jackson the default JSON provider
> > >
> > > +1 to making Jackson the default JSON provider. &nbsp;Most other JAX-RS
> impls
> > use
> > > it as their default AFAIK, Jackson is a quite active community, and the
> > main
> > > dev lead over there (Tatu Saloranta) was the main developer on Woodstox
> > STAX
> > > parser. &nbsp;It's a very high quality project.
> > >
> > > Looking at WINK-299, I'm not sure what Jason has that Jackson does not
> > > already provide by default. &nbsp;The JacksonJsonProvider, which is the
> base
> > > class for JacksonJaxbJsonProvider, already has all of what's shown in
> 299
> > as
> > > its defaults:
> > >
> > >
> >
> http://svn.jackson.codehaus.org/browse/jackson/trunk/src/jaxrs/java/org/codehaus/jackson/jaxrs/JacksonJsonProvider.java?r=HEAD
> > > (see locateMapper method, line 565)
> > >
> > > Jason, is the explicit mapper instantiation still required, per your
> code
> > > snippet in WINK-299?
> > >
> > > mike
> > >
> > >
> > > On Tue, Sep 21, 2010 at 10:59 AM, Jesse A Ramos <jr...@us.ibm.com>
> > wrote:
> > >
> > >> In reference to WINK-299:
> > https://issues.apache.org/jira/browse/WINK-299
> > >>
> > >> Hi,
> > >>
> > >> As mentioned in WINK-299, Jackson seems to be the best available JSON
> > >> provider. &nbsp;It would be good to make this default for WINK.
> &nbsp;I don't mind
> > >> making the change but wanted to get some opinions on a couple of
> things.
> > >>
> > >> 1) Does everyone agree that Jackson should be the default JSON
> provider?
> > >> 2) If so, what default configuration settings should we use?
> > >>
> > >> For question 2, Jason provided a code snippet for what he is using in
> > >> WINK-299. &nbsp;It likes good to me as a default configuration.
> &nbsp;If others
> > >> agree I can use that, otherwise let me know what other configuration
> > >> settings you would like to use.
> > >>
> > >> Thanks,
> > >> Jesse
> > >
> >
> >
>
>


Re: Making Jackson the default JSON provider

Posted by Mike Rheinheimer <ro...@apache.org>.
Yeah, Jesse's right.  JacksonJsonProvider and JacksonJaxbJsonProvider both
support Jackson annotations.  The JacksonJaxbJsonProvider adds support for
JAXB annotations.  I love that my prior incorrectness will live on forever
in infamy!

:)
Thanks.
mike

On Tue, Sep 21, 2010 at 2:39 PM, Jesse A Ramos <jr...@us.ibm.com> wrote:

>  +1
>
> The doc seems to indicate that JacksonJaxbJsonProvider has the same
> functionality as JacksonJsonProvider except that it adds the JAXB support.
> JacksonJaxbJsonProvider extends JacksonJsonProvider.
> - Jesse
>
> -----Mike Rheinheimer <ro...@apache.org> wrote: -----
>
> To: wink-dev@incubator.apache.org
> From: Mike Rheinheimer <ro...@apache.org>
> Date: 09/21/2010 02:20PM
> Subject: Re: Making Jackson the default JSON provider
>
> Yup, Jason, you make a good point. &nbsp;If an app developer wishes to use
> Jackson-specific annotations, they must use JacksonJaxbJsonProvider, so
> let's be sure to make that the Wink default, not JacksonJsonProvider, if we
> intend to allow for that. &nbsp;If we don't, then Wink app developers would
> have
> to declare JacksonJaxbJsonProvider themselves in their Application subclass
> getClasses method.
>
> I'm ok with making JacksonJaxbJsonProvider the Wink default, thereby
> allowing Jackson-specific annotations out-of-the-box. &nbsp;Any other
> opinions?
>
> mike
>
>
> On Tue, Sep 21, 2010 at 1:45 PM, Jason Dillon <ja...@planet57.com> wrote:
>
> > The short answer is... I don't know ;-) &nbsp;It does look like the
> latest 1.6
> > JacksonJaxbJsonProvider should work fine as-is. &nbsp;I've just updated
> my app to
> > configure a JacksonJaxbJsonProvider.class via getClasses() and it seems
> > happy enough.
> >
> > I do use the jaxb+json provider here because I am using some jackson
> > specific annotations, specifically @JsonTypeInfo, to enrich the json data
> > slightly in some cases. &nbsp;This helps bridge the gap between xml &
> json wrt
> > lists of heterogeneous data. &nbsp;Xml worked due to the additional
> namespaces
> > introduced, json didn't w/o a little bit of help from jackson.
> >
> > --jason
> >
> >
> > On Sep 21, 2010, at 9:44 AM, Jesse A Ramos wrote:
> >
> > > Thanks Mike,
> > >
> > > Your question was going to be my next one =). Didn't want to convolute
> > the original query.
> > >
> > > I took a look at the Jackson javadoc but didn't find anything that said
> > what the defaults were. &nbsp;It seemed to me, based on the functionality
> of
> > JacksonJaxbJsonProvider and JacksonJsonProvider, that the defaults were
> > likely the same but I wasn't sure.
> > >
> > > - Jesse
> > >
> > > -----Mike Rheinheimer <ro...@apache.org> wrote: -----
> > >
> > > To: wink-dev@incubator.apache.org
> > > From: Mike Rheinheimer <ro...@apache.org>
> > > Date: 09/21/2010 11:30AM
> > > Subject: Re: Making Jackson the default JSON provider
> > >
> > > +1 to making Jackson the default JSON provider. &nbsp;Most other JAX-RS
> impls
> > use
> > > it as their default AFAIK, Jackson is a quite active community, and the
> > main
> > > dev lead over there (Tatu Saloranta) was the main developer on Woodstox
> > STAX
> > > parser. &nbsp;It's a very high quality project.
> > >
> > > Looking at WINK-299, I'm not sure what Jason has that Jackson does not
> > > already provide by default. &nbsp;The JacksonJsonProvider, which is the
> base
> > > class for JacksonJaxbJsonProvider, already has all of what's shown in
> 299
> > as
> > > its defaults:
> > >
> > >
> >
> http://svn.jackson.codehaus.org/browse/jackson/trunk/src/jaxrs/java/org/codehaus/jackson/jaxrs/JacksonJsonProvider.java?r=HEAD
> > > (see locateMapper method, line 565)
> > >
> > > Jason, is the explicit mapper instantiation still required, per your
> code
> > > snippet in WINK-299?
> > >
> > > mike
> > >
> > >
> > > On Tue, Sep 21, 2010 at 10:59 AM, Jesse A Ramos <jr...@us.ibm.com>
> > wrote:
> > >
> > >> In reference to WINK-299:
> > https://issues.apache.org/jira/browse/WINK-299
> > >>
> > >> Hi,
> > >>
> > >> As mentioned in WINK-299, Jackson seems to be the best available JSON
> > >> provider. &nbsp;It would be good to make this default for WINK.
> &nbsp;I don't mind
> > >> making the change but wanted to get some opinions on a couple of
> things.
> > >>
> > >> 1) Does everyone agree that Jackson should be the default JSON
> provider?
> > >> 2) If so, what default configuration settings should we use?
> > >>
> > >> For question 2, Jason provided a code snippet for what he is using in
> > >> WINK-299. &nbsp;It likes good to me as a default configuration.
> &nbsp;If others
> > >> agree I can use that, otherwise let me know what other configuration
> > >> settings you would like to use.
> > >>
> > >> Thanks,
> > >> Jesse
> > >
> >
> >
>
>

Re: Making Jackson the default JSON provider

Posted by Jesse A Ramos <jr...@us.ibm.com>.
 +1

The doc seems to indicate that JacksonJaxbJsonProvider has the same functionality as JacksonJsonProvider except that it adds the JAXB support. JacksonJaxbJsonProvider extends JacksonJsonProvider.  
- Jesse
 
-----Mike Rheinheimer <ro...@apache.org> wrote: -----

To: wink-dev@incubator.apache.org
From: Mike Rheinheimer <ro...@apache.org>
Date: 09/21/2010 02:20PM
Subject: Re: Making Jackson the default JSON provider

Yup, Jason, you make a good point. &nbsp;If an app developer wishes to use
Jackson-specific annotations, they must use JacksonJaxbJsonProvider, so
let's be sure to make that the Wink default, not JacksonJsonProvider, if we
intend to allow for that. &nbsp;If we don't, then Wink app developers would have
to declare JacksonJaxbJsonProvider themselves in their Application subclass
getClasses method.

I'm ok with making JacksonJaxbJsonProvider the Wink default, thereby
allowing Jackson-specific annotations out-of-the-box. &nbsp;Any other opinions?

mike


On Tue, Sep 21, 2010 at 1:45 PM, Jason Dillon <ja...@planet57.com> wrote:

> The short answer is... I don't know ;-) &nbsp;It does look like the latest 1.6
> JacksonJaxbJsonProvider should work fine as-is. &nbsp;I've just updated my app to
> configure a JacksonJaxbJsonProvider.class via getClasses() and it seems
> happy enough.
>
> I do use the jaxb+json provider here because I am using some jackson
> specific annotations, specifically @JsonTypeInfo, to enrich the json data
> slightly in some cases. &nbsp;This helps bridge the gap between xml & json wrt
> lists of heterogeneous data. &nbsp;Xml worked due to the additional namespaces
> introduced, json didn't w/o a little bit of help from jackson.
>
> --jason
>
>
> On Sep 21, 2010, at 9:44 AM, Jesse A Ramos wrote:
>
> > Thanks Mike,
> >
> > Your question was going to be my next one =). Didn't want to convolute
> the original query.
> >
> > I took a look at the Jackson javadoc but didn't find anything that said
> what the defaults were. &nbsp;It seemed to me, based on the functionality of
> JacksonJaxbJsonProvider and JacksonJsonProvider, that the defaults were
> likely the same but I wasn't sure.
> >
> > - Jesse
> >
> > -----Mike Rheinheimer <ro...@apache.org> wrote: -----
> >
> > To: wink-dev@incubator.apache.org
> > From: Mike Rheinheimer <ro...@apache.org>
> > Date: 09/21/2010 11:30AM
> > Subject: Re: Making Jackson the default JSON provider
> >
> > +1 to making Jackson the default JSON provider. &nbsp;Most other JAX-RS impls
> use
> > it as their default AFAIK, Jackson is a quite active community, and the
> main
> > dev lead over there (Tatu Saloranta) was the main developer on Woodstox
> STAX
> > parser. &nbsp;It's a very high quality project.
> >
> > Looking at WINK-299, I'm not sure what Jason has that Jackson does not
> > already provide by default. &nbsp;The JacksonJsonProvider, which is the base
> > class for JacksonJaxbJsonProvider, already has all of what's shown in 299
> as
> > its defaults:
> >
> >
> http://svn.jackson.codehaus.org/browse/jackson/trunk/src/jaxrs/java/org/codehaus/jackson/jaxrs/JacksonJsonProvider.java?r=HEAD
> > (see locateMapper method, line 565)
> >
> > Jason, is the explicit mapper instantiation still required, per your code
> > snippet in WINK-299?
> >
> > mike
> >
> >
> > On Tue, Sep 21, 2010 at 10:59 AM, Jesse A Ramos <jr...@us.ibm.com>
> wrote:
> >
> >> In reference to WINK-299:
> https://issues.apache.org/jira/browse/WINK-299
> >>
> >> Hi,
> >>
> >> As mentioned in WINK-299, Jackson seems to be the best available JSON
> >> provider. &nbsp;It would be good to make this default for WINK. &nbsp;I don't mind
> >> making the change but wanted to get some opinions on a couple of things.
> >>
> >> 1) Does everyone agree that Jackson should be the default JSON provider?
> >> 2) If so, what default configuration settings should we use?
> >>
> >> For question 2, Jason provided a code snippet for what he is using in
> >> WINK-299. &nbsp;It likes good to me as a default configuration. &nbsp;If others
> >> agree I can use that, otherwise let me know what other configuration
> >> settings you would like to use.
> >>
> >> Thanks,
> >> Jesse
> >
>
>


Re: Making Jackson the default JSON provider

Posted by Mike Rheinheimer <ro...@apache.org>.
Yup, Jason, you make a good point.  If an app developer wishes to use
Jackson-specific annotations, they must use JacksonJaxbJsonProvider, so
let's be sure to make that the Wink default, not JacksonJsonProvider, if we
intend to allow for that.  If we don't, then Wink app developers would have
to declare JacksonJaxbJsonProvider themselves in their Application subclass
getClasses method.

I'm ok with making JacksonJaxbJsonProvider the Wink default, thereby
allowing Jackson-specific annotations out-of-the-box.  Any other opinions?

mike


On Tue, Sep 21, 2010 at 1:45 PM, Jason Dillon <ja...@planet57.com> wrote:

> The short answer is... I don't know ;-)  It does look like the latest 1.6
> JacksonJaxbJsonProvider should work fine as-is.  I've just updated my app to
> configure a JacksonJaxbJsonProvider.class via getClasses() and it seems
> happy enough.
>
> I do use the jaxb+json provider here because I am using some jackson
> specific annotations, specifically @JsonTypeInfo, to enrich the json data
> slightly in some cases.  This helps bridge the gap between xml & json wrt
> lists of heterogeneous data.  Xml worked due to the additional namespaces
> introduced, json didn't w/o a little bit of help from jackson.
>
> --jason
>
>
> On Sep 21, 2010, at 9:44 AM, Jesse A Ramos wrote:
>
> > Thanks Mike,
> >
> > Your question was going to be my next one =). Didn't want to convolute
> the original query.
> >
> > I took a look at the Jackson javadoc but didn't find anything that said
> what the defaults were.  It seemed to me, based on the functionality of
> JacksonJaxbJsonProvider and JacksonJsonProvider, that the defaults were
> likely the same but I wasn't sure.
> >
> > - Jesse
> >
> > -----Mike Rheinheimer <ro...@apache.org> wrote: -----
> >
> > To: wink-dev@incubator.apache.org
> > From: Mike Rheinheimer <ro...@apache.org>
> > Date: 09/21/2010 11:30AM
> > Subject: Re: Making Jackson the default JSON provider
> >
> > +1 to making Jackson the default JSON provider.  Most other JAX-RS impls
> use
> > it as their default AFAIK, Jackson is a quite active community, and the
> main
> > dev lead over there (Tatu Saloranta) was the main developer on Woodstox
> STAX
> > parser.  It's a very high quality project.
> >
> > Looking at WINK-299, I'm not sure what Jason has that Jackson does not
> > already provide by default.  The JacksonJsonProvider, which is the base
> > class for JacksonJaxbJsonProvider, already has all of what's shown in 299
> as
> > its defaults:
> >
> >
> http://svn.jackson.codehaus.org/browse/jackson/trunk/src/jaxrs/java/org/codehaus/jackson/jaxrs/JacksonJsonProvider.java?r=HEAD
> > (see locateMapper method, line 565)
> >
> > Jason, is the explicit mapper instantiation still required, per your code
> > snippet in WINK-299?
> >
> > mike
> >
> >
> > On Tue, Sep 21, 2010 at 10:59 AM, Jesse A Ramos <jr...@us.ibm.com>
> wrote:
> >
> >> In reference to WINK-299:
> https://issues.apache.org/jira/browse/WINK-299
> >>
> >> Hi,
> >>
> >> As mentioned in WINK-299, Jackson seems to be the best available JSON
> >> provider.  It would be good to make this default for WINK.  I don't mind
> >> making the change but wanted to get some opinions on a couple of things.
> >>
> >> 1) Does everyone agree that Jackson should be the default JSON provider?
> >> 2) If so, what default configuration settings should we use?
> >>
> >> For question 2, Jason provided a code snippet for what he is using in
> >> WINK-299.  It likes good to me as a default configuration.  If others
> >> agree I can use that, otherwise let me know what other configuration
> >> settings you would like to use.
> >>
> >> Thanks,
> >> Jesse
> >
>
>

Re: Making Jackson the default JSON provider

Posted by Jason Dillon <ja...@planet57.com>.
The short answer is... I don't know ;-)  It does look like the latest 1.6 JacksonJaxbJsonProvider should work fine as-is.  I've just updated my app to configure a JacksonJaxbJsonProvider.class via getClasses() and it seems happy enough.

I do use the jaxb+json provider here because I am using some jackson specific annotations, specifically @JsonTypeInfo, to enrich the json data slightly in some cases.  This helps bridge the gap between xml & json wrt lists of heterogeneous data.  Xml worked due to the additional namespaces introduced, json didn't w/o a little bit of help from jackson.

--jason

	
On Sep 21, 2010, at 9:44 AM, Jesse A Ramos wrote:

> Thanks Mike,
> 
> Your question was going to be my next one =). Didn't want to convolute the original query.
> 
> I took a look at the Jackson javadoc but didn't find anything that said what the defaults were.  It seemed to me, based on the functionality of JacksonJaxbJsonProvider and JacksonJsonProvider, that the defaults were likely the same but I wasn't sure.
> 
> - Jesse
> 
> -----Mike Rheinheimer <ro...@apache.org> wrote: -----
> 
> To: wink-dev@incubator.apache.org
> From: Mike Rheinheimer <ro...@apache.org>
> Date: 09/21/2010 11:30AM
> Subject: Re: Making Jackson the default JSON provider
> 
> +1 to making Jackson the default JSON provider.  Most other JAX-RS impls use
> it as their default AFAIK, Jackson is a quite active community, and the main
> dev lead over there (Tatu Saloranta) was the main developer on Woodstox STAX
> parser.  It's a very high quality project.
> 
> Looking at WINK-299, I'm not sure what Jason has that Jackson does not
> already provide by default.  The JacksonJsonProvider, which is the base
> class for JacksonJaxbJsonProvider, already has all of what's shown in 299 as
> its defaults:
> 
> http://svn.jackson.codehaus.org/browse/jackson/trunk/src/jaxrs/java/org/codehaus/jackson/jaxrs/JacksonJsonProvider.java?r=HEAD
> (see locateMapper method, line 565)
> 
> Jason, is the explicit mapper instantiation still required, per your code
> snippet in WINK-299?
> 
> mike
> 
> 
> On Tue, Sep 21, 2010 at 10:59 AM, Jesse A Ramos <jr...@us.ibm.com> wrote:
> 
>> In reference to WINK-299: https://issues.apache.org/jira/browse/WINK-299
>> 
>> Hi,
>> 
>> As mentioned in WINK-299, Jackson seems to be the best available JSON
>> provider.  It would be good to make this default for WINK.  I don't mind
>> making the change but wanted to get some opinions on a couple of things.
>> 
>> 1) Does everyone agree that Jackson should be the default JSON provider?
>> 2) If so, what default configuration settings should we use?
>> 
>> For question 2, Jason provided a code snippet for what he is using in
>> WINK-299.  It likes good to me as a default configuration.  If others
>> agree I can use that, otherwise let me know what other configuration
>> settings you would like to use.
>> 
>> Thanks,
>> Jesse
> 


Re: Making Jackson the default JSON provider

Posted by Jesse A Ramos <jr...@us.ibm.com>.
Thanks Mike,

Your question was going to be my next one =). Didn't want to convolute the original query.

I took a look at the Jackson javadoc but didn't find anything that said what the defaults were.  It seemed to me, based on the functionality of JacksonJaxbJsonProvider and JacksonJsonProvider, that the defaults were likely the same but I wasn't sure.

- Jesse

-----Mike Rheinheimer <ro...@apache.org> wrote: -----

To: wink-dev@incubator.apache.org
From: Mike Rheinheimer <ro...@apache.org>
Date: 09/21/2010 11:30AM
Subject: Re: Making Jackson the default JSON provider

+1 to making Jackson the default JSON provider.  Most other JAX-RS impls use
it as their default AFAIK, Jackson is a quite active community, and the main
dev lead over there (Tatu Saloranta) was the main developer on Woodstox STAX
parser.  It's a very high quality project.

Looking at WINK-299, I'm not sure what Jason has that Jackson does not
already provide by default.  The JacksonJsonProvider, which is the base
class for JacksonJaxbJsonProvider, already has all of what's shown in 299 as
its defaults:

http://svn.jackson.codehaus.org/browse/jackson/trunk/src/jaxrs/java/org/codehaus/jackson/jaxrs/JacksonJsonProvider.java?r=HEAD
(see locateMapper method, line 565)

Jason, is the explicit mapper instantiation still required, per your code
snippet in WINK-299?

mike


On Tue, Sep 21, 2010 at 10:59 AM, Jesse A Ramos <jr...@us.ibm.com> wrote:

> In reference to WINK-299: https://issues.apache.org/jira/browse/WINK-299
>
> Hi,
>
> As mentioned in WINK-299, Jackson seems to be the best available JSON
> provider.  It would be good to make this default for WINK.  I don't mind
> making the change but wanted to get some opinions on a couple of things.
>
> 1) Does everyone agree that Jackson should be the default JSON provider?
> 2) If so, what default configuration settings should we use?
>
> For question 2, Jason provided a code snippet for what he is using in
> WINK-299.  It likes good to me as a default configuration.  If others
> agree I can use that, otherwise let me know what other configuration
> settings you would like to use.
>
> Thanks,
> Jesse


Re: Making Jackson the default JSON provider

Posted by Mike Rheinheimer <ro...@apache.org>.
+1 to making Jackson the default JSON provider.  Most other JAX-RS impls use
it as their default AFAIK, Jackson is a quite active community, and the main
dev lead over there (Tatu Saloranta) was the main developer on Woodstox STAX
parser.  It's a very high quality project.

Looking at WINK-299, I'm not sure what Jason has that Jackson does not
already provide by default.  The JacksonJsonProvider, which is the base
class for JacksonJaxbJsonProvider, already has all of what's shown in 299 as
its defaults:

http://svn.jackson.codehaus.org/browse/jackson/trunk/src/jaxrs/java/org/codehaus/jackson/jaxrs/JacksonJsonProvider.java?r=HEAD
(see locateMapper method, line 565)

Jason, is the explicit mapper instantiation still required, per your code
snippet in WINK-299?

mike


On Tue, Sep 21, 2010 at 10:59 AM, Jesse A Ramos <jr...@us.ibm.com> wrote:

> In reference to WINK-299: https://issues.apache.org/jira/browse/WINK-299
>
> Hi,
>
> As mentioned in WINK-299, Jackson seems to be the best available JSON
> provider.  It would be good to make this default for WINK.  I don't mind
> making the change but wanted to get some opinions on a couple of things.
>
> 1) Does everyone agree that Jackson should be the default JSON provider?
> 2) If so, what default configuration settings should we use?
>
> For question 2, Jason provided a code snippet for what he is using in
> WINK-299.  It likes good to me as a default configuration.  If others
> agree I can use that, otherwise let me know what other configuration
> settings you would like to use.
>
> Thanks,
> Jesse

Re: Making Jackson the default JSON provider

Posted by Nicholas L Gallardo <nl...@us.ibm.com>.
+1




                                                                           
             Jesse A                                                       
             Ramos/Austin/IBM@                                             
             IBMUS                                                      To 
                                       "wink-dev@incubator.apache.org"     
             09/21/2010 10:59          <wi...@incubator.apache.org>     
             AM                                                         cc 
                                                                           
                                                                   Subject 
             Please respond to         Making Jackson the default JSON     
             wink-dev@incubato         provider                            
               r.apache.org                                                
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




In reference to WINK-299: https://issues.apache.org/jira/browse/WINK-299

Hi,

As mentioned in WINK-299, Jackson seems to be the best available JSON
provider.  It would be good to make this default for WINK.  I don't mind
making the change but wanted to get some opinions on a couple of things.

1) Does everyone agree that Jackson should be the default JSON provider?
2) If so, what default configuration settings should we use?

For question 2, Jason provided a code snippet for what he is using in
WINK-299.  It likes good to me as a default configuration.  If others
agree I can use that, otherwise let me know what other configuration
settings you would like to use.

Thanks,
Jesse