Re: NON-SPRING JSON array serialization workaround please??

2014-01-14 Thread Sergey Beryozkin

On 14/01/14 15:34, rpd wrote:

Thanks - useful to know and it would indeed be a handy feature to be able to do this.  By 
"writing my own application" do you mean that I would follow...

http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAX-RSservicesprogrammatically

using specifically the JAXRSServerFactoryBean? Would this be outside of my 
web-container (Tomcat)?


No, you create your own custom JAX-RS Application and register it with 
CXFJaxrsNonSpringServlet using the parameter name as required by the 
spec, "javax.ws.rs.Application",


Cheers, Sergey



Rob



  From: Sergey Beryozkin [via CXF] 
To: rpd 
Sent: Tuesday, 14 January 2014, 12:12
Subject: Re: NON-SPRING JSON array serialization workaround please??



Hi
On 14/01/14 11:34, rpd wrote:


No, the above would set the endpoint properties, JSONProvider does not
check them, one can do it like this:


jaxrs.providers

  org.apache.cxf.systest.jaxrs.BookStoreProvider1
  org.apache.cxf.systest.jaxrs.BookStoreProvider2(a=b c=d)

   

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









If you reply to this email, your message will be added to the discussion below: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442p5738535.html
To unsubscribe from NON-SPRING JSON array serialization workaround please??, 
click here.
NAML



--
View this message in context: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442p5738547.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com


Re: NON-SPRING JSON array serialization workaround please??

2014-01-14 Thread rpd
Thanks - useful to know and it would indeed be a handy feature to be able to do 
this.  By "writing my own application" do you mean that I would follow...

http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAX-RSservicesprogrammatically

using specifically the JAXRSServerFactoryBean? Would this be outside of my 
web-container (Tomcat)?

Rob
 


 From: Sergey Beryozkin [via CXF] 
To: rpd  
Sent: Tuesday, 14 January 2014, 12:12
Subject: Re: NON-SPRING JSON array serialization workaround please??
  


Hi 
On 14/01/14 11:34, rpd wrote: 


No, the above would set the endpoint properties, JSONProvider does not 
check them, one can do it like this: 

 
   jaxrs.providers 
    
     org.apache.cxf.systest.jaxrs.BookStoreProvider1 
     org.apache.cxf.systest.jaxrs.BookStoreProvider2(a=b c=d) 
    
   

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 








 
If you reply to this email, your message will be added to the discussion below: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442p5738535.html
 
To unsubscribe from NON-SPRING JSON array serialization workaround please??, 
click here.
NAML



--
View this message in context: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442p5738547.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: NON-SPRING JSON array serialization workaround please??

2014-01-14 Thread rpd
Ok thanks - will investigate this too.  Rob
 


 From: Sergey Beryozkin [via CXF] 
To: rpd  
Sent: Tuesday, 14 January 2014, 12:25
Subject: Re: NON-SPRING JSON array serialization workaround please??
  


I was wrong, in fact it is already being tested, you need to do 
something like: 

 
             jaxrs.providers 
              
                            org.apache.cxf.jaxrs.provider.json.JSONProvider( 
                              dropRootElement=false 
                              attributesToElements=true 
                              arrayKeys=a 
                              arrayKeys=b 
                            ), 
  
org.apache.cxf.jaxrs.provider.JAXBElementProvider 
                        
          

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: 




-- 
Sergey Beryozkin 

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

Blog: http://sberyozkin.blogspot.com/





 
If you reply to this email, your message will be added to the discussion below: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442p5738536.html
 
To unsubscribe from NON-SPRING JSON array serialization workaround please??, 
click here.
NAML



--
View this message in context: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442p5738546.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: NON-SPRING JSON array serialization workaround please??

2014-01-14 Thread Sergey Beryozkin
I was wrong, in fact it is already being tested, you need to do 
something like:



jaxrs.providers

   org.apache.cxf.jaxrs.provider.json.JSONProvider(
 dropRootElement=false
 attributesToElements=true
 arrayKeys=a
 arrayKeys=b
   ),

org.apache.cxf.jaxrs.provider.JAXBElementProvider
  


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...

  
 jaxrs.properties

   serializeAsArray=true

  

Is that it?


No, the above would set the endpoint properties, JSONProvider does not
check them, one can do it like this:


   jaxrs.providers
   
 org.apache.cxf.systest.jaxrs.BookStoreProvider1
 org.apache.cxf.systest.jaxrs.BookStoreProvider2(a=b c=d)
   
  

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]

To: rpd 
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


Re: NON-SPRING JSON array serialization workaround please??

2014-01-14 Thread Sergey Beryozkin

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...

  
 jaxrs.properties

   serializeAsArray=true

  

Is that it?

No, the above would set the endpoint properties, JSONProvider does not 
check them, one can do it like this:



  jaxrs.providers
  
org.apache.cxf.systest.jaxrs.BookStoreProvider1
org.apache.cxf.systest.jaxrs.BookStoreProvider2(a=b c=d)
  
 

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] 
To: rpd 
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:








Re: NON-SPRING JSON array serialization workaround please??

2014-01-14 Thread rpd
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...

 
    jaxrs.properties
   
  serializeAsArray=true
   
 

Is that it?

Rob

 


 From: Sergey Beryozkin [via CXF] 
To: rpd  
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/





 
If you reply to this email, your message will be added to the discussion below: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442p5738478.html
  
To unsubscribe from NON-SPRING JSON array serialization workaround please??, 
click here.
NAML



--
View this message in context: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442p5738534.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: NON-SPRING JSON array serialization workaround please??

2014-01-12 Thread Sergey Beryozkin

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:

Hi,

The fact that Jettison incorrectly handles single-element arrays (as
http://jira.codehaus.org/browse/JETTISON-102) is unfortunately causing us
lots of problems.  Though there is a well-publicized Spring workaround we
are not using CXF with Spring (and have no plans to either).

How can I set the Jettison "serializeAsArray" parameter WITHOUT SPRING?  Is
there some way I can do it in my service code programmatically?  Can I
configure it somehow as an init param in web.xml?

Would really appreciate some help here before we resort to desparate
measures.

Rob



--
View this message in context: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com


NON-SPRING JSON array serialization workaround please??

2014-01-10 Thread rpd
Hi,  

The fact that Jettison incorrectly handles single-element arrays (as
http://jira.codehaus.org/browse/JETTISON-102) is unfortunately causing us
lots of problems.  Though there is a well-publicized Spring workaround we
are not using CXF with Spring (and have no plans to either).

How can I set the Jettison "serializeAsArray" parameter WITHOUT SPRING?  Is
there some way I can do it in my service code programmatically?  Can I
configure it somehow as an init param in web.xml?

Would really appreciate some help here before we resort to desparate
measures.

Rob



--
View this message in context: 
http://cxf.547215.n5.nabble.com/NON-SPRING-JSON-array-serialization-workaround-please-tp5738442.html
Sent from the cxf-user mailing list archive at Nabble.com.