>> 1. Some of the providers I configure programmatically implement JAX-RS
>> interfaces and are provided by CXF or other frameworks,
>> e.g. CrossOriginResourceSharingFilter, MultipartProvider, 
>> JacksonJsonProvider, WebApplicationExceptionMapper.
>> How do I make these known to my JAX-RS Whiteboard  (Whiteboard service)
>> ?Just derive a new class, annotate as a Component and JaxrsExtension?

You have several options here, some of which have already been described, but 
there are some which have been overlooked.

Some extensions (such as support for Jackson’s JSON) are already available for 
the whiteboard. For example this integration project comes from Aries 
<https://github.com/apache/aries-jax-rs-whiteboard/tree/master/integrations/jackson>.
You can make use of the JAX-RS whiteboard’s dependency system to build your own 
JAX-RS feature which you then rely on.

For example:

@Component
@JaxrsName(“myFeature")
@JaxrsExtension
public class MyFeature implements Feature {

    @Override
    public boolean configure(FeatureContext fc) {
        fc.register(CrossOriginResourceSharingFilter.class);
    }

} 

You can then add requirements for this feature to your resources (ideally using 
config admin) using the osgi.jaxrs.extension.select property described in 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#service.jaxrs.common.properties
 
<https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#service.jaxrs.common.properties>


>> 2. Swagger2Feature, JAASLoginInterceptor, FastInfosetFeature, GZIPFeature, 
>> CORSPreflightInterceptor (my
>> code, extends AbstractPhaseInterceptor<Message>) are provided by CXF and
>> implement CXF interfaces. I gather I can't use these directly with the
>> Whiteboard? What do I do with those?  Reimplement/port to JAX-RS?

There are ways to make these existing features work, but it is a much better 
idea to port to the standard JAX-RS APIs, otherwise you’ll end up coupled to 
CXF unnecessarily.

Best Regards,

Tim


> On 28 Dec 2018, at 17:51, Jean-Baptiste Onofré <j...@nanthrax.net> wrote:
> 
> Hi,
> 
> you can take a look on the Karaf JAXRS Whiteboard sample:
> 
> https://github.com/apache/karaf/pull/697
> 
> I gonna merge it tonight or tomorrow morning.
> 
> Regards
> JB
> 
> On 28/12/2018 16:23, Oliver Schweitzer wrote:
>> Hi,
>> 
>> I have an existing REST JAX-RS Application based on CXF mechanics. that
>> is the Resources are lifecycle managed by a programmatically setup
>> JAXRSServerFactoryBean, which itself gets started and stopped by an
>> immediate @Component
>> 
>> Now I want to build new entrypoints (and eventually migrate old ones)
>> using the JAX-RS whiteboard, as discussed e.g.
>> here 
>> http://karaf.922171.n3.nabble.com/Aries-JAX-RS-Whiteboard-td4054440.html,
>> and go full dynamically discovered declarative services with my REST API
>> and application. 
>> 
>> The basic setup (without extensions) works very well,  now I want to
>> replace all my programmatic CXF configuration with @Components annotated
>> with @JaxrsExtension, use only JAX-RS/Whiteboard mechanics and no more
>> CXF specialties if possible.
>> 
>> Now for the questions: 
>> 
>> 1. Some of the providers I configure programmatically implement JAX-RS
>> interfaces and are provided by CXF or other frameworks,
>> e.g. CrossOriginResourceSharingFilter, MultipartProvider, 
>> JacksonJsonProvider, WebApplicationExceptionMapper.
>> How do I make these known to my JAX-RS Whiteboard  (Whiteboard service)
>> ?Just derive a new class, annotate as a Component and JaxrsExtension?
>> 
>> 2. Swagger2Feature, JAASLoginInterceptor, FastInfosetFeature, GZIPFeature, 
>> CORSPreflightInterceptor (my
>> code, extends AbstractPhaseInterceptor<Message>) are provided by CXF and
>> implement CXF interfaces. I gather I can't use these directly with the
>> Whiteboard? What do I do with those?  Reimplement/port to JAX-RS?
>> 
>> Best regards,
>> 
>> Oliver
>> 
>> 
>> 
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Reply via email to