Hi

On 01/05/16 20:14, Vjacheslav V. Borisov wrote:
Started playing with MOXy. I write here in case some else will need to
switch JSON provider to MOXy.

     <bean id="jsonProvider"
class="org.eclipse.persistence.jaxb.rs.MOXyJsonProvider">
         <property name="namespacePrefixMapper" ref="namespaceMap"/>
         <property name="namespaceSeparator" value=":"/>
         <property name="formattedOutput" value="true"/>
         <property name="attributePrefix" value="@"/>
         <property name="includeRoot" value="true"/>
         <property name="marshalEmptyCollections" value="false"/>
     </bean>
So, if no schema validation or extraClass support required, it is working
out of box, only need to change property names.

Interesting it is nearly a one to one replacement...


Actually I have adapted org.eclipse.persistence.jaxb.rs.MOXyJsonProvider to
make it more cxf-friendly, e.g to accept SchemaHandler to allow JSON schema
validation as Jettison does
https://github.com/ilb/common/blob/master/common-jaxrs/src/main/java/ru/ilb/common/jaxrs/json/MOXyJsonProvider.java

It is still JAXB and XMLSchema in CXF JSONProvider...I believe Jackson can handle pure JSON schemas


And also copied from AbstractJAXBProvider extraClass and contextProperties
support to custom JaxbContextResolver
https://github.com/ilb/common/blob/master/common-jaxrs/src/main/java/ru/ilb/common/jaxrs/jaxb/JaxbContextResolver.java

Sure, setting a Moxy ContextResolver should also make CXF JAX-RS providers capable of supporting Moxy JAXB.

But does this Moxy provider handle an array serialization issue correctly without the extra arrayKeys config ?

Cheers, Sergey


2016-04-26 17:12 GMT+04:00 Vjacheslav V. Borisov <slav...@gmail.com>:

Thanks, I was  thinking about, but swtiching from jettison is last thing
what I wanted to do...
Becouse I really loved symmetry in configuring both
org.apache.cxf.jaxrs.provider.JAXBElementProvider and
org.apache.cxf.jaxrs.provider.json.JSONProvider almost identically
and schema validation, and singleJaxbContext, and extraClass...

Well, looks like I can use javax.ws.rs.ext.ContextResolver to get similar
functionality  like  extraClass.
And try to use diffferent JSON provider





--
Sergey Beryozkin

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

Reply via email to