cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francesco Chicchiriccò <ilgro...@apache.org>
Subject Re: Cannot deserialize JSON via JacksonJaxbJsonProvider (that works via Jackson's ObjectMapperm anyway)
Date Mon, 22 Jul 2013 12:21:34 GMT
On 22/07/2013 14:12, Sergey Beryozkin wrote:
> Hi Francesco,
>
> I'm realizing I've typed a lot of nonsense to do with typed proxies 
> :-), the underlying issue is to do with the proxy implementation not 
> unwrapping TypeVariable.
>
> The fix will go in as soon as the current Apache LDAP issues get 
> resolved.

OT: resetting your password via https://id.apache.org should fix.

> Note though, you'd still need to add @JsonTypeInfo to AbstractSchemaTO 
> if you need to access the specific subtype's info in the client code, 
> otherwise Jackson will not be able to create subtype instances from 
> the payload.

Understood.

Regards.

> On 19/07/13 09:26, Francesco Chicchiriccò wrote:
>> 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/


Mime
View raw message