users@jersey.java.net

[Jersey] Fwd: Re: Json and polymorphism

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Wed, 26 Jan 2011 11:36:09 -0800

Whops, forgot that mailing list config had changed so default is not
reply-all... so here goes:

---------- Forwarded message ----------
From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Tue, Jan 25, 2011 at 10:09 AM
Subject: Re: [Jersey] Re: Json and polymorphism

On Tue, Jan 25, 2011 at 5:44 AM, Paul Sandoz <Paul.Sandoz_at_oracle.com> wrote:
>
> On Jan 25, 2011, at 11:16 AM, Grenzinger Yannick wrote:
>
> Hello,
>
> We are trying to do json serialization and deserialization on polymorphic
> types with this annotation :
> @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY,
> property="@class")
> The solution advised by Jackson here :
> http://wiki.fasterxml.com/JacksonPolymorphicDeserialization
>
> But we have always this error :
> com.sun.jersey.api.client.ClientHandlerException:
> org.codehaus.jackson.map.JsonMappingException: Unexpected token
> (END_OBJECT), expected FIELD_NAME: missing property '_at_class' that is to
> contain type id  (for class com.vsct.rd.emerch.model.filter.Filter)
>
> This bug seems to be known and corrected in Jackson 1.7 :
> http://jira.codehaus.org/browse/JACKSON-356?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel
>
> What is your current status in Jersey ? (you’re using Jackson true ?)
>
>
> In Jersey 1.5 it is version 1.5.5.
> I suspect you can probably override the version to 1.7 without issue.
> We should upgrade in 1.6-SNAPSHOT. Jakub?

For what it's worth, the biggest end-user impacting upgrade was
between 1.2 and 1.3 (due to accidental binary incompatibility issue).
Between 1.6 and 1.7 a few semi-public interfaces (serializer and
deserializer providers) were changed, but I do not think Jersey
extends those, so it seems likely that both 1.5 -> 1.6 and 1.6 -> 1.7
upgrades should work by simple jar upgrade.

1.6 branch is still being actively maintained, so upgrade to 1.6 is
likely to address most issues that exist in 1.5. So gradual upgrade
may make sense too (not that I know of any regressions with 1.7).

-+ Tatu +-