Apache CXF is a web services framework for Java. We’ve successfully developed clients (consumers) and services using it. The official website is at cxf.apache.org.
Interceptors listen and act upon incoming or outgoing messages. The CXF library can be used as both client and server, so an outgoing message from a client may be considered in incoming message on the server.
AbstractPhaseInterceptor is the base class. Method
handleMessage() must be implemented, and optionally
can be overridden. If there is a fault, then inside handleFault(), you can access details via
Exception exception = message.getContent(Exception.class); Throwable cause = exception.getCause();
An example of an interceptor is a custom logger.
The phase must be chosen when the interceptor is constructed. Look at the Phase class for a valid phase name, and refer to the CXF Interceptors documentation for a description of the various phases.
Request and response objects
Get a handle on the request or response objects using the following snippet:
javax.xml.ws.Holder maybe used for objects used for both request and response.