Hi!

I have web application, which serves json using two different json
providers: jettison and moxy

Jettison

     <bean id="jsonProvider"
class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
        <property name="namespaceMap" ref="namespaceMap"/>
        <property name="contextProperties" ref="contextProperties"/>
        <property name="namespaceSeparator" value=":"/>
        <property name="singleJaxbContext" value="true"/>
        <property name="schemaHandler" ref="schemaHandler"/>
        <property name="serializeAsArray" value="true"/>
        <property name="arrayKeys" ref="JSONArrayKeys"/>
    </bean>

Moxy

    <bean id="jsonProviderV2"
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"/>
    </bean>

JSON providers listening on different URLs using two separate jaxrs:server

Jettsion
<jaxrs:server address="/" ...>
        <jaxrs:providers>
            <ref bean="jsonProvider"/>



Moxy

<jaxrs:server address="/v2" ...>
        <jaxrs:providers>
            <ref bean="jsonProviderV2"/>


My problem, that while during marshalling (response) on moxy ("v2") url,
moxy json provider is picked, as required, but in case of unmarshalling
(request), jettison is picked, becouse it is configured "by default" (not
in beans.xml)

How to disable / change priority of jettion provider on second url (v2), or
may be other solution exists to make two providers work in same application
using some switch in url or query string?

Reply via email to