cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julio Carlos Barrera Juez <juliocarlos.barr...@i2cat.net>
Subject Re: Using Jackson as JSON body reader/writer with DOSGi
Date Mon, 17 Jun 2013 10:19:59 GMT
Hi!

I'm trying to achieve the same configuration than you, Neil. I'm not using
Spring, but Blueprint. Moreover, I have a multi-bundle configuration. I
have DOSGi that offers REST API of my services published in the OSGi
Service Registry. I have one of these services that needs to be serialized
using JSON instead of XML. Then, I want to use Jackson 2.2.x (FasterXML
Maven group ID, not Codehaus) as JSON provider, but I don't know how to
tell DOSGi using my own JSON provider.

I have tried using DOSGi property "org.apache.cxf.rs.provider" with value
"com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider", but I get:

"No message body reader has been found for request class ModelObjectA,
ContentType : application/json."

and "415 Unsupported Media Type" in client.

I have tried to declare my JSON provider as a bean in my blueprint, but I
does not work. The problem is that "DOSGi is not declared in any place", it
is an OSGi feature declared as a bundle in my OSGi container. Then, I have
no way to configure it.

What can I do?

Thank you very much.


On 14 June 2013 15:19, Julio Carlos Barrera Juez <
juliocarlos.barrera@i2cat.net> wrote:

> Thank you very much, I will try it on Monday ;-) Have a nice weekend!
>
>
> On 14 June 2013 15:17, NCorbet <Neil.Corbet@gmail.com> wrote:
>
>> Julio,
>>
>> Here is configuration I added to my spring file to use
>> JacksonJaxbJsonProvider:
>>
>> <bean id="jaxbAnnotationInspector"
>> class="org.codehaus.jackson.xc.JaxbAnnotationIntrospector" />
>> <bean id="jacksonObjectMapper"
>> class="org.codehaus.jackson.map.ObjectMapper">
>>                 <property name="annotationIntrospector"
>> ref="jaxbAnnotationInspector" />
>> </bean>
>>
>> <bean id="jsonProvider"
>> class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider" />
>>
>> You need to set the jaxbAnnotationIntrospector in the ObjectMapper so it
>> forces Jackson to look at JaxB annotations first. This worked well for
>> me...until I needed to Marshall/UnMarshall abstract types. If you are ok
>> with mixing Jackson and Jaxb annotations then this should be no big deal
>> to
>> you ( the abstract type issue that is, the rest worked fine).
>>
>> Hope that helps
>>
>>
>>
>> --
>> View this message in context:
>> http://cxf.547215.n5.nabble.com/Using-Jackson-as-JSON-body-reader-writer-with-DOSGi-tp5729257p5729278.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message