cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: NON-SPRING JSON array serialization workaround please??
Date Tue, 14 Jan 2014 12:24:54 GMT
I was wrong, in fact it is already being tested, you need to do 
something like:

<init-param>
             <param-name>jaxrs.providers</param-name>
             <param-value>
                            org.apache.cxf.jaxrs.provider.json.JSONProvider(
                              dropRootElement=false
                              attributesToElements=true
                              arrayKeys=a
                              arrayKeys=b
                            ),
 
org.apache.cxf.jaxrs.provider.JAXBElementProvider
                       </param-value>
         </init-param>

But going the Application way will offer a more flexible approach (in 
case you need to setup some Map properties, etc)

Cheers, Sergey

On 14/01/14 12:11, Sergey Beryozkin wrote:
> Hi
> On 14/01/14 11:34, rpd wrote:
>> Hi,
>>
>> Thanks a lot for the reply. We are using the non Spring Servlet.
>> Presumably, then, in web.xml I would need only to include the entry...
>>
>>   <init-param>
>>      <param-name>jaxrs.properties</param-name>
>>         <param-value>
>>            serializeAsArray=true
>>         </param-value>
>>   </init-param>
>>
>> Is that it?
>>
> No, the above would set the endpoint properties, JSONProvider does not
> check them, one can do it like this:
>
> <init-param>
>    <param-name>jaxrs.providers</param-name>
>    <param-value>
>      org.apache.cxf.systest.jaxrs.BookStoreProvider1
>      org.apache.cxf.systest.jaxrs.BookStoreProvider2(a=b c=d)
>    </param-value>
>   </init-param>
>
> In this case though it won't help actually, it is only possible to
> inject simple non-collection properties and the arrayKeys JSONProvider
> property is a list. I can see it can be supported easily enough too, but
> not at the moment.
>
> The only way then for now is to register a custom JAX-RS Application
> when you can directly configure the provider
>
> Cheers, Sergey
>
>> Rob
>>
>>
>>
>> ________________________________
>>   From: Sergey Beryozkin [via CXF]
>> <ml-node+s547215n5738478h78@n5.nabble.com>
>> To: rpd <Robpodolski@yahoo.co.uk>
>> Sent: Sunday, 12 January 2014, 18:24
>> Subject: Re: NON-SPRING JSON array serialization workaround please??
>>
>>
>>
>> Hi
>>
>> You can use CXFNonSpringJaxrsServlet where JSONProvider is configured
>> via either custom JAX-RS Application or declaratively, see
>> http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAX-RSservicesincontainerwithoutSpring
>>
>>
>> Cheers, Sergey
>> On 10/01/14 12:11, rpd wrote:
>>
>> ________________________________
>>
>>
>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Mime
View raw message