Skip to content

Latest commit

 

History

History

bootique-cxf-jakarta-core

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

bootique-cxf-core

Provides and configures core CXF components, such as Bus, Extensions, Configurer, Features, Interceptors etc. It allows you to configure and extend CXF via Guice dependency injection. This module is not intended to be used by itself, rather in the conjunction with JAX-WS Server, JAX-WS Client or JAX-RS Server modules.

Providing CXF features

A Feature in CXF is a way of adding capabilities to a Server, Client or Bus. For example, you could add the ability to log messages for each of these objects, by configuring them with a LoggingFeature. You can provide them in your application module:

class App implements Module {
    public void config(Binder binder) {
        CxfModule.extend(binder)
                .addFeature(LoggingFeature.class)
                .addFeature(new GZIPFeature());
    }
}

Providing CXF Bus interceptors

Interceptors are the fundamental processing unit inside CXF. When a service is invoked, an InterceptorChain is created and invoked. Each interceptor gets a chance to do what they want with the message. This can include reading it, transforming it, processing headers, validating the message, etc.

class App implements Module {
    public void config(Binder binder) {
        CxfModule.extend(binder)
                        .contributeBusInterceptors()
                        .addInInterceptor(new LoggingInInterceptor())
                        .addOutInterceptor(GZIPOutInterceptor.class);
    }
}

Bus interceptors will be used both in clients and server endpoints. If you want to provide client-only or server-only interceptors, check client and server modules.

Advanced configuration

Providing extensions

CXF uses extensions mechanism to provide core internal components. You can use Guice binding to override any of them:

class App implements Module {
    public void config(Binder binder) {
        binder.bind(WSDLManager.class).to(CustomWSDLManager.class);
    }
}

Configuring beans

CXF provides mechanism for configuring internally created beans. Those implement org.apache.cxf.configuration.Configurable interface and include such entities, as EndpointImpl, ServiceImpl, HTTPConduit etc. You can provide your own custom configurer in a module:

class App implements Module {
    public void config(Binder binder) {
        CxfModule.extend(binder)
                .addCustomConfigurer(HTTPConduit.class, CustomHTTPConduitConfigurer.class);
    }
}