Configuring the Bus
The Bus is the backbone of the CXF architecture. It manages extensions and acts as an interceptor provider. The interceptors for the bus will be added to the respective inbound and outbound message and fault interceptor chains for all client and server endpoints created on the bus (in its context). By default, it contributes no interceptors to either of these interceptor chain types, but they can be added via configuration files or with Java code, as shown below.
Note: For endpoint-specific configuration (as opposed to configuration for all for endpoints created by the CXF bus), look at the Logging Messages section for code samples.
Using a Configuration File
Here, simply define a bus element in your Spring configuration file, and add child elements as required, for example:
<bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
The configurable properties of the bus are defined in the bus configuration schema http://cxf.apache.org/schemas/core.xsd. Be sure to include the namespace - URI pair for this schema in the schemaLocation attribute of the <beans> element.
The <bus> element supports the following child elements:
The interceptors contributed to inbound message interceptor chains. A list of <bean>s or <ref>s.
The interceptors contributed to inbound fault interceptor chains. A list of <bean>s or <ref>s.
The interceptors contributed to outbound message interceptor chains. A list of <bean>s or <ref>s.
The interceptors contributed to outbound fault interceptor chains. A list of <bean>s or <ref>s.
Contextual properties which will be applied to all endpoints and clients using this bus
The features applied to the bus. A list of <bean>s or <ref>s. See here for a list of available features.
Configuration using Java code
Although usually less convenient, interceptors can be added to the bus using Java code. Given an EndpointImpl object, the bus can be accessed (and interceptors added) as follows:
Object implementor = new GreeterImpl();
EndpointImpl ep = (EndpointImpl) Endpoint.publish("http://localhost/service", implementor);
Extending the Bus
TODO: Explain how to add a custom bus extension (META-INF/cxf/cxf.extension ...).