Hi Francesco, Hmm ... I am was pretty sure that the code has worked. Will double check and keep you updated.
Regards, Andrei. > -----Original Message----- > From: Francesco Chicchiriccò [mailto:[email protected]] > Sent: Freitag, 19. Juli 2013 10:27 > To: [email protected] > Subject: Re: Cannot deserialize JSON via JacksonJaxbJsonProvider (that > works via Jackson's ObjectMapperm anyway) > > On 18/07/2013 23:44, Andrei Shakirin wrote: > > Hi Francesco, > > > > I am not 100% sure that is a solution for your case, but I have used Jackson > specific annotation in AbstractSchemaTO: > > @JsonTypeInfo(use=Id.CLASS, include=As.PROPERTY, property="class"). > > > > Annotation is currently deactivated, because it causes conflicts with > Syncope Spring MVC Rest implementation. > > The annotation forces client to send concrete class name in JSON > representation, as a result service has more information to construct > concrete class. > > As I can remember, I have tested this code for JSON using CXF JAX-RS client > and service. > > > > Could you try to activate it and retest? > > Hi Andrei, > when adding such Jackson annotation to AbstractSchemaTO, the JSON > payload actually adds the expected attribute: > > { > "class": "org.apache.syncope.common.to.SchemaTO", > "name": "fullname", > "type": "String", > "mandatoryCondition": "true", > "enumerationValues": null, > "enumerationKeys": null, > "multivalue": false, > "uniqueConstraint": true, > "readonly": false, > "conversionPattern": null, > "validatorClass": null > } > > However, this still generates the (same) exception: > > java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to > org.apache.syncope.common.to.AbstractSchemaTO > > BTW, I have verified via debug that in ProviderBase (ancestor of > JacksonJaxbJsonProvider), the method readFrom() is invoked with > parameters > > Class<Object> type => class > org.apache.syncope.common.to.AbstractSchemaTO > Type genericType => T, with name > ""org.apache.syncope.common.to.AbstractSchemaTO" > > Regards. > > -- > Francesco Chicchiriccò > > ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member > http://people.apache.org/~ilgrosso/
