You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Jason Dillon (JIRA)" <ji...@apache.org> on 2010/07/08 02:48:49 UTC

[jira] Created: (WINK-299) Make Jackson the default JSON provider for Wink

Make Jackson the default JSON provider for Wink
-----------------------------------------------

                 Key: WINK-299
                 URL: https://issues.apache.org/jira/browse/WINK-299
             Project: Wink
          Issue Type: Improvement
          Components: Providers
            Reporter: Jason Dillon


Jackson seems to be the only JSON provider that works well (the other ones work in limited situations, but Jackson seems to handle it all well).  So IMO Jackson should be considered as the default JSON provider for Wink.

ATM the Jackson module doesn't provide a Provider impl, it should get a proper implementation that sets up a reasonable configuration.  This has been working very, very well for me:

{code}
        ObjectMapper mapper = new ObjectMapper();
        AnnotationIntrospector pair = new AnnotationIntrospector.Pair(
            new JaxbAnnotationIntrospector(), new JacksonAnnotationIntrospector());
        mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
        mapper.getSerializationConfig().setAnnotationIntrospector(pair);
        JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
        provider.setMapper(mapper);
{code}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WINK-299) Make Jackson the default JSON provider for Wink

Posted by "Jesse Ramos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Ramos reassigned WINK-299:
--------------------------------

    Assignee: Jesse Ramos

> Make Jackson the default JSON provider for Wink
> -----------------------------------------------
>
>                 Key: WINK-299
>                 URL: https://issues.apache.org/jira/browse/WINK-299
>             Project: Wink
>          Issue Type: Improvement
>          Components: Providers
>            Reporter: Jason Dillon
>            Assignee: Jesse Ramos
>
> Jackson seems to be the only JSON provider that works well (the other ones work in limited situations, but Jackson seems to handle it all well).  So IMO Jackson should be considered as the default JSON provider for Wink.
> ATM the Jackson module doesn't provide a Provider impl, it should get a proper implementation that sets up a reasonable configuration.  This has been working very, very well for me:
> {code}
>         ObjectMapper mapper = new ObjectMapper();
>         AnnotationIntrospector pair = new AnnotationIntrospector.Pair(
>             new JaxbAnnotationIntrospector(), new JacksonAnnotationIntrospector());
>         mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
>         mapper.getSerializationConfig().setAnnotationIntrospector(pair);
>         JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
>         provider.setMapper(mapper);
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WINK-299) Make Jackson the default JSON provider for Wink

Posted by "Jesse Ramos (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Ramos resolved WINK-299.
------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1.2

> Make Jackson the default JSON provider for Wink
> -----------------------------------------------
>
>                 Key: WINK-299
>                 URL: https://issues.apache.org/jira/browse/WINK-299
>             Project: Wink
>          Issue Type: Improvement
>          Components: Providers
>            Reporter: Jason Dillon
>            Assignee: Jesse Ramos
>             Fix For: 1.1.2
>
>
> Jackson seems to be the only JSON provider that works well (the other ones work in limited situations, but Jackson seems to handle it all well).  So IMO Jackson should be considered as the default JSON provider for Wink.
> ATM the Jackson module doesn't provide a Provider impl, it should get a proper implementation that sets up a reasonable configuration.  This has been working very, very well for me:
> {code}
>         ObjectMapper mapper = new ObjectMapper();
>         AnnotationIntrospector pair = new AnnotationIntrospector.Pair(
>             new JaxbAnnotationIntrospector(), new JacksonAnnotationIntrospector());
>         mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
>         mapper.getSerializationConfig().setAnnotationIntrospector(pair);
>         JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
>         provider.setMapper(mapper);
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-299) Make Jackson the default JSON provider for Wink

Posted by "Jason Dillon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913168#action_12913168 ] 

Jason Dillon commented on WINK-299:
-----------------------------------

The JacksonJaxbJsonProvider seems to work just fine as-is.  So probably only need to add a META-INF/wink-application (or whatever that file is for providers) to hook it up.

> Make Jackson the default JSON provider for Wink
> -----------------------------------------------
>
>                 Key: WINK-299
>                 URL: https://issues.apache.org/jira/browse/WINK-299
>             Project: Wink
>          Issue Type: Improvement
>          Components: Providers
>            Reporter: Jason Dillon
>
> Jackson seems to be the only JSON provider that works well (the other ones work in limited situations, but Jackson seems to handle it all well).  So IMO Jackson should be considered as the default JSON provider for Wink.
> ATM the Jackson module doesn't provide a Provider impl, it should get a proper implementation that sets up a reasonable configuration.  This has been working very, very well for me:
> {code}
>         ObjectMapper mapper = new ObjectMapper();
>         AnnotationIntrospector pair = new AnnotationIntrospector.Pair(
>             new JaxbAnnotationIntrospector(), new JacksonAnnotationIntrospector());
>         mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
>         mapper.getSerializationConfig().setAnnotationIntrospector(pair);
>         JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
>         provider.setMapper(mapper);
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-299) Make Jackson the default JSON provider for Wink

Posted by "Jesse Ramos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913193#action_12913193 ] 

Jesse Ramos commented on WINK-299:
----------------------------------

Thanks for the udpate. I'll get the change in soon.

> Make Jackson the default JSON provider for Wink
> -----------------------------------------------
>
>                 Key: WINK-299
>                 URL: https://issues.apache.org/jira/browse/WINK-299
>             Project: Wink
>          Issue Type: Improvement
>          Components: Providers
>            Reporter: Jason Dillon
>
> Jackson seems to be the only JSON provider that works well (the other ones work in limited situations, but Jackson seems to handle it all well).  So IMO Jackson should be considered as the default JSON provider for Wink.
> ATM the Jackson module doesn't provide a Provider impl, it should get a proper implementation that sets up a reasonable configuration.  This has been working very, very well for me:
> {code}
>         ObjectMapper mapper = new ObjectMapper();
>         AnnotationIntrospector pair = new AnnotationIntrospector.Pair(
>             new JaxbAnnotationIntrospector(), new JacksonAnnotationIntrospector());
>         mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
>         mapper.getSerializationConfig().setAnnotationIntrospector(pair);
>         JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
>         provider.setMapper(mapper);
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-299) Make Jackson the default JSON provider for Wink

Posted by "Jesse Ramos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12914131#action_12914131 ] 

Jesse Ramos commented on WINK-299:
----------------------------------

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.  I think we should suppress these from being written.

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

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

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

> Make Jackson the default JSON provider for Wink
> -----------------------------------------------
>
>                 Key: WINK-299
>                 URL: https://issues.apache.org/jira/browse/WINK-299
>             Project: Wink
>          Issue Type: Improvement
>          Components: Providers
>            Reporter: Jason Dillon
>
> Jackson seems to be the only JSON provider that works well (the other ones work in limited situations, but Jackson seems to handle it all well).  So IMO Jackson should be considered as the default JSON provider for Wink.
> ATM the Jackson module doesn't provide a Provider impl, it should get a proper implementation that sets up a reasonable configuration.  This has been working very, very well for me:
> {code}
>         ObjectMapper mapper = new ObjectMapper();
>         AnnotationIntrospector pair = new AnnotationIntrospector.Pair(
>             new JaxbAnnotationIntrospector(), new JacksonAnnotationIntrospector());
>         mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
>         mapper.getSerializationConfig().setAnnotationIntrospector(pair);
>         JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
>         provider.setMapper(mapper);
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-299) Make Jackson the default JSON provider for Wink

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915416#action_12915416 ] 

Hudson commented on WINK-299:
-----------------------------

Integrated in Wink-Trunk-JDK1.5 #387 (See [https://hudson.apache.org/hudson/job/Wink-Trunk-JDK1.5/387/])
    [WINK-299] Add WinkJacksonJaxbJsonProvider provider and corresponding wink-aplication file


> Make Jackson the default JSON provider for Wink
> -----------------------------------------------
>
>                 Key: WINK-299
>                 URL: https://issues.apache.org/jira/browse/WINK-299
>             Project: Wink
>          Issue Type: Improvement
>          Components: Providers
>            Reporter: Jason Dillon
>            Assignee: Jesse Ramos
>
> Jackson seems to be the only JSON provider that works well (the other ones work in limited situations, but Jackson seems to handle it all well).  So IMO Jackson should be considered as the default JSON provider for Wink.
> ATM the Jackson module doesn't provide a Provider impl, it should get a proper implementation that sets up a reasonable configuration.  This has been working very, very well for me:
> {code}
>         ObjectMapper mapper = new ObjectMapper();
>         AnnotationIntrospector pair = new AnnotationIntrospector.Pair(
>             new JaxbAnnotationIntrospector(), new JacksonAnnotationIntrospector());
>         mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
>         mapper.getSerializationConfig().setAnnotationIntrospector(pair);
>         JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
>         provider.setMapper(mapper);
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.