You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by joseph jobbings <jo...@rocketmail.com> on 2015/03/22 21:48:10 UTC

how-to : custom ResourceComparator with DOSGi and declarative services?

I'd like to add a custom resourceComparator for use with my DOSGi JAX-RS /CXF service endpoints but I don't know how to register it with the approach we've taken: annotations-based, declarative services.  Is it possible to register a custom ResourceComparator in a similar fashion to how we register custom mappers and filters, e.g. through annotations along the lines of,   @Property(name = "org.apache.cxf.rs.provider", classValue = { FooMapper.class, BarFilter.class } ?

I can find examples of how to set a custom resource comparator via the web descriptor or Spring config but I haven't found a reference to similar in the cxf DOSGi documentation.  Pages that list available properties, like http://cxf.apache.org/distributed-osgi-reference.html, don't mention it. Is that because it's not possible via this approach?

Any pointers, much appreciated.


Re: how-to : custom ResourceComparator with DOSGi and declarative services?

Posted by joseph jobbings <jo...@rocketmail.com>.
Thanks very much Sergey - I'll give that a try...

      From: Sergey Beryozkin <sb...@gmail.com>
 To: users@cxf.apache.org 
 Sent: Monday, March 23, 2015 12:57 PM
 Subject: Re: how-to : custom ResourceComparator with DOSGi and declarative services?
   
Hi


On 22/03/15 20:48, joseph jobbings wrote:
> I'd like to add a custom resourceComparator for use with my DOSGi JAX-RS /CXF service endpoints but I don't know how to register it with the approach we've taken: annotations-based, declarative services.  Is it possible to register a custom ResourceComparator in a similar fashion to how we register custom mappers and filters, e.g. through annotations along the lines of,  @Property(name = "org.apache.cxf.rs.provider", classValue = { FooMapper.class, BarFilter.class } ?
>
> I can find examples of how to set a custom resource comparator via the web descriptor or Spring config but I haven't found a reference to similar in the cxf DOSGi documentation.  Pages that list available properties, like http://cxf.apache.org/distributed-osgi-reference.html, don't mention it. Is that because it's not possible via this approach?
>
> Any pointers, much appreciated.
>
>
Custom ResourceComparator is registered using an 
"org.apache.cxf.jaxrs.comparator" contextual property,

I've just checked CXF DOSGi source, one can set RS properties as a map, 
using "org.apache.cxf.rs.context.properties".

HTH, Sergey



  

Re: how-to : custom ResourceComparator with DOSGi and declarative services?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 22/03/15 20:48, joseph jobbings wrote:
> I'd like to add a custom resourceComparator for use with my DOSGi JAX-RS /CXF service endpoints but I don't know how to register it with the approach we've taken: annotations-based, declarative services.  Is it possible to register a custom ResourceComparator in a similar fashion to how we register custom mappers and filters, e.g. through annotations along the lines of,   @Property(name = "org.apache.cxf.rs.provider", classValue = { FooMapper.class, BarFilter.class } ?
>
> I can find examples of how to set a custom resource comparator via the web descriptor or Spring config but I haven't found a reference to similar in the cxf DOSGi documentation.  Pages that list available properties, like http://cxf.apache.org/distributed-osgi-reference.html, don't mention it. Is that because it's not possible via this approach?
>
> Any pointers, much appreciated.
>
>
Custom ResourceComparator is registered using an 
"org.apache.cxf.jaxrs.comparator" contextual property,

I've just checked CXF DOSGi source, one can set RS properties as a map, 
using "org.apache.cxf.rs.context.properties".

HTH, Sergey