Search in sources :

Example 1 with ReactiveIOCustomizer

use of org.apache.cxf.jaxrs.rx3.server.ReactiveIOCustomizer in project cxf by apache.

the class RxJava2MaybeServer method createServer.

@Override
protected Server createServer(Bus bus) throws Exception {
    // Make sure default JSONProvider is not loaded
    bus.setProperty("skip.default.json.provider.registration", true);
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setProvider(new JacksonJsonProvider());
    new ReactiveIOCustomizer().customize(sf);
    sf.getOutInterceptors().add(new LoggingOutInterceptor());
    sf.setResourceClasses(RxJava2MaybeService.class);
    sf.setResourceProvider(RxJava2MaybeService.class, new SingletonResourceProvider(new RxJava2MaybeService(), true));
    sf.setAddress("http://localhost:" + PORT + "/");
    return sf.create();
}
Also used : ReactiveIOCustomizer(org.apache.cxf.jaxrs.rx2.server.ReactiveIOCustomizer) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Example 2 with ReactiveIOCustomizer

use of org.apache.cxf.jaxrs.rx3.server.ReactiveIOCustomizer in project cxf by apache.

the class RxJava2ObservableServer method createServer.

@Override
protected Server createServer(Bus bus) throws Exception {
    bus.setProperty("skip.default.json.provider.registration", true);
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setProvider(new JacksonJsonProvider());
    sf.setProvider(new IllegalStateExceptionMapper());
    new ReactiveIOCustomizer().customize(sf);
    sf.getOutInterceptors().add(new LoggingOutInterceptor());
    sf.setResourceClasses(RxJava2ObservableService.class);
    sf.setResourceProvider(RxJava2ObservableService.class, new SingletonResourceProvider(new RxJava2ObservableService(), true));
    sf.setAddress("http://localhost:" + PORT + "/");
    return sf.create();
}
Also used : ReactiveIOCustomizer(org.apache.cxf.jaxrs.rx2.server.ReactiveIOCustomizer) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Example 3 with ReactiveIOCustomizer

use of org.apache.cxf.jaxrs.rx3.server.ReactiveIOCustomizer in project cxf by apache.

the class RxJava2SingleServer method createServer.

@Override
protected Server createServer(Bus bus) throws Exception {
    // Make sure default JSONProvider is not loaded
    bus.setProperty("skip.default.json.provider.registration", true);
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setProvider(new JacksonJsonProvider());
    new ReactiveIOCustomizer().customize(sf);
    sf.getOutInterceptors().add(new LoggingOutInterceptor());
    sf.setResourceClasses(RxJava2SingleService.class);
    sf.setResourceProvider(RxJava2SingleService.class, new SingletonResourceProvider(new RxJava2SingleService(), true));
    sf.setAddress("http://localhost:" + PORT + "/");
    return sf.create();
}
Also used : ReactiveIOCustomizer(org.apache.cxf.jaxrs.rx2.server.ReactiveIOCustomizer) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Example 4 with ReactiveIOCustomizer

use of org.apache.cxf.jaxrs.rx3.server.ReactiveIOCustomizer in project cxf by apache.

the class RxJava3SingleServer method createServer.

@Override
protected Server createServer(Bus bus) throws Exception {
    // Make sure default JSONProvider is not loaded
    bus.setProperty("skip.default.json.provider.registration", true);
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setProvider(new JacksonJsonProvider());
    new ReactiveIOCustomizer().customize(sf);
    sf.getOutInterceptors().add(new LoggingOutInterceptor());
    sf.setResourceClasses(RxJava3SingleService.class);
    sf.setResourceProvider(RxJava3SingleService.class, new SingletonResourceProvider(new RxJava3SingleService(), true));
    sf.setAddress("http://localhost:" + PORT + "/");
    return sf.create();
}
Also used : ReactiveIOCustomizer(org.apache.cxf.jaxrs.rx3.server.ReactiveIOCustomizer) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Example 5 with ReactiveIOCustomizer

use of org.apache.cxf.jaxrs.rx3.server.ReactiveIOCustomizer in project cxf by apache.

the class RxJava2FlowableServer method createFactoryBean.

private JAXRSServerFactoryBean createFactoryBean(boolean useStreamingSubscriber, String relAddress) {
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.getProperties(true).put("useStreamingSubscriber", useStreamingSubscriber);
    sf.setProvider(new JacksonJsonProvider());
    sf.setProvider(new IllegalArgumentExceptionMapper());
    sf.setProvider(new IllegalStateExceptionMapper());
    new ReactiveIOCustomizer().customize(sf);
    sf.getOutInterceptors().add(new LoggingOutInterceptor());
    sf.setResourceClasses(RxJava2FlowableService.class);
    sf.setResourceProvider(RxJava2FlowableService.class, new SingletonResourceProvider(new RxJava2FlowableService(), true));
    sf.setAddress("http://localhost:" + PORT + relAddress);
    return sf;
}
Also used : ReactiveIOCustomizer(org.apache.cxf.jaxrs.rx2.server.ReactiveIOCustomizer) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JacksonJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) SingletonResourceProvider(org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)

Aggregations

JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)9 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)9 JAXRSServerFactoryBean (org.apache.cxf.jaxrs.JAXRSServerFactoryBean)9 SingletonResourceProvider (org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)9 ReactiveIOCustomizer (org.apache.cxf.jaxrs.rx2.server.ReactiveIOCustomizer)5 ReactiveIOCustomizer (org.apache.cxf.jaxrs.rx3.server.ReactiveIOCustomizer)4