Hi
On 25/06/14 13:47, Vassilis Virvilis wrote:
Hi,

My problem looks like this
http://mail-archives.apache.org/mod_mbox/cxf-users/201307.mbox/%3c51e6a843.1080...@apache.org%3E


I am using cxf 3.0.0 so I believe the thread does not apply and I am not
sure what I should do or try based on that thread.

My problem is that I am trying to call

     @POST
     @Path("existing-entity")
     @Consumes("application/x-www-form-urlencoded")
     public Entity getExistingEntity(
             @FormParam("entity") Entity entity)
             throws SQLException;

with an entity and the service is instantiating the Entity based on
String constructor which looks like a fallback CXF strategy around
./rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java:393


The jackson provider is not called to do the deserialization. I don't
know why. Similarly as the link I provide above if I pass the json
payload that the client is sending to objectMapper.getValue(json,
Entity.class) everything works correctly.

So the question is why jackson is not involved during deserialization?.

JAX-RS MessageBodyReader is not involved into reading individual parameters, it can only handle a method parameter representing a complete HTML request body, i.e. the parameters without JAX-RS annotations like PathParam, HeaderParam or FormParam. You need to register JAX-RS 2.0 ParamConverterProvider for Entity which will use Jackson mapper to convert a given String value into Entity

HTH, Sergey

It works fine for serialization.

My guess the fail is in somewhere around  InjectionUtils.java:358

         Object result = createFromParameterHandler(value, pClass,
paramAnns, message);
         if (result != null) {
             return pClass.cast(result);
         }

but I don't know enough to debug this.

     Vassilis



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to