Hello,
I have a REST service which returns a com.foo.Base class. This class is
part of a complex domain hierarchy which looks like this:
/com.foo.Base -> com.foo.Base1 -> com.foo.Base2 -> com.foo.Base3/ and
Base3 is extended by multiple Concrete implementors.
What I want to achieve is to have "xsi:type" set in the returned XML
when a concrete class instance is used. I went through the documentation
and added "JaxbElementClassNames" to my JAXBProvider. Here is my config:
<bean id="jaxbProvider"
class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
<property name="marshallerProperties" ref="marshallerPropertiesMap" />
<property name="jaxbElementClassNames" ref="myJaxbElementClassNames"/>
</bean>
<util:map id="marshallerPropertiesMap">
<entry key="jaxb.encoding">
<value type="java.lang.String">UTF-8</value>
</entry>
</util:map>
<util:list id="myJaxbElementClassNames">
<value>/com.foo.Base/</value>
<value>/com.foo.Base/1</value>
<value>/com.foo.Base/2</value>
<value>/com.foo.Base/3</value>
<value>/com.foo.Concrete1/</value>
<value>/com.foo.Concrete2/</value>
<value>/com.foo.Concrete3/</value>
<value>/com.foo.Concrete4/</value>
</util:list>
<jaxrs:server id="clientServer" address="/">
<jaxrs:providers>
<ref bean="systemExceptionMapper" />
<ref bean="jaxbProvider" />
<ref bean="jsonProvider"/>
<ref bean="followUpFilter" />
</jaxrs:providers>
...
</jaxrs:server>
The result is that the xsi:type attribute is not added. All the concrete
classes and com.foo.Base have @XMLRootElement annotation (the other base
ones DO NOT). @XMLSeeAlso is added in all the classes.
I'm using apache 2.4.7.
Thanks for the help. Any ideas are welcome!
Cheers,
Nikolay