Have you checked
http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml?

Could you attach all relevant parts of your cxf.xml? That includes e.g.
<jaxr:server>. Also attach the object that contains array/collection. Are
the collection items annotated as myArray1 or myArray2?

-- 
S pozdravom
Ladislav Lenčucha
[email protected]



On Tue, Nov 27, 2012 at 2:19 PM, Lars Beiderbecke <
[email protected]> wrote:

> Hello,
>
> I'm trying to work around the JSON array serialization bug of Jettison
> in conjunction with CXF as described in
>
>    <
> http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-DealingwithJSONarrayserializationissues
> >
>
> I've created a WEB-INF/classes/cxf.xml file that sets the properties
> mentioned:
>
>   <beans xmlns="http://www.springframework.org/schema/beans";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xmlns:util="http://www.springframework.org/schema/util";
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-2.0.xsd";>
>     <util:list id="jsonKeys">
>       <value>myArray1</value>
>       <value>myArray2</value>
>     </util:list>
>   <bean id="jsonProvider"
> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>       <property name="serializeAsArray" value="true"/>
>       <property name="arrayKeys" ref="jsonKeys"/>
>     </bean>
>   </beans>
>
> Alas, this is not working:
>
>    {"MyModel":{"myVal1":"val","myArray1":123,"myArray2":456}}
>
> but I have no idea what is missing here. The log doesn't show anything
> unusual.
>
> Note that I'm using the non-Spring servlet:
>
>   <servlet>
>     <servlet-name>CXFServlet</servlet-name>
>
> <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
>     <init-param>
>       <param-name>jaxrs.serviceClasses</param-name>
>       <param-value>test.RestService</param-value>
>     </init-param>
>     <load-on-startup>1</load-on-startup>
>   </servlet>
>
> Is the workaround even supposed to function without Spring? Any help
> would be highly appreciated.
>
> Regards
> Lars
>

Reply via email to