Chapter 63. Apache CXF Provided Interceptors

63.1. Core Apache CXF Interceptors

Inbound

Table 63.1, “Core inbound interceptors” lists the core inbound interceptors that are added to all Apache CXF endpoints.

Table 63.1. Core inbound interceptors

ClassPhaseDescription

ServiceInvokerInterceptor

INVOKE

Invokes the proper method on the service.

Outbound

The Apache CXF does not add any core interceptors to the outbound interceptor chain by default. The contents of an endpoint’s outbound interceptor chain depend on the features in use.

63.2. Front-Ends

JAX-WS

Table 63.2, “Inbound JAX-WS interceptors” lists the interceptors added to a JAX-WS endpoint’s inbound message chain.

Table 63.2. Inbound JAX-WS interceptors

ClassPhaseDescription

HolderInInterceptor

PRE_INVOKE

Creates holder objects for any out or in/out parameters in the message.

WrapperClassInInterceptor

POST_LOGICAL

Unwraps the parts of a wrapped doc/literal message into the appropriate array of objects.

LogicalHandlerInInterceptor

PRE_PROTOCOL

Passes message processing to the JAX-WS logical handlers used by the endpoint. When the JAX-WS handlers complete, the message is passed along to the next interceptor on the inbound chain.

SOAPHandlerInterceptor

PRE_PROTOCOL

Passes message processing to the JAX-WS SOAP handlers used by the endpoint. When the SOAP handlers finish with the message, the message is passed along to the next interceptor in the chain.

Table 63.3, “Outbound JAX-WS interceptors” lists the interceptors added to a JAX-WS endpoint’s outbound message chain.

Table 63.3. Outbound JAX-WS interceptors

ClassPhaseDescription

HolderOutInterceptor

PRE_LOGICAL

Removes the values of any out and in/out parameters from their holder objects and adds the values to the message’s parameter list.

WebFaultOutInterceptor

PRE_PROTOCOL

Processes outbound fault messages.

WrapperClassOutInterceptor

PRE_LOGICAL

Makes sure that wrapped doc/literal messages and rpc/literal messages are properly wrapped before being added to the message.

LogicalHandlerOutInterceptor

PRE_MARSHAL

Passes message processing to the JAX-WS logical handlers used by the endpoint. When the JAX-WS handlers complete, the message is passed along to the next interceptor on the outbound chain.

SOAPHandlerInterceptor

PRE_PROTOCOL

Passes message processing to the JAX-WS SOAP handlers used by the endpoint. When the SOAP handlers finish processing the message, it is passed along to the next interceptor in the chain.

MessageSenderInterceptor

PREPARE_SEND

Calls back to the Destination object to have it setup the output streams, headers, etc. to prepare the outgoing transport.

JAX-RS

Table 63.4, “Inbound JAX-RS interceptors” lists the interceptors added to a JAX-RS endpoint’s inbound message chain.

Table 63.4. Inbound JAX-RS interceptors

ClassPhaseDescription

JAXRSInInterceptor

PRE_STREAM

Selects the root resource class, invokes any configured JAX-RS request filters, and determines the method to invoke on the root resource.

Important

The inbound chain for a JAX-RS endpoint skips straight to the ServiceInvokerInInterceptor interceptor. No other interceptors will be invoked after the JAXRSInInterceptor.

Table 63.5, “Outbound JAX-RS interceptors” lists the interceptors added to a JAX-RS endpoint’s outbound message chain.

Table 63.5. Outbound JAX-RS interceptors

ClassPhaseDescription

JAXRSOutInterceptor

MARSHAL

Marshals the response into the proper format for transmission.

63.3. Message bindings

SOAP

Table 63.6, “Inbound SOAP interceptors” lists the interceptors added to a endpoint’s inbound message chain when using the SOAP Binding.

Table 63.6. Inbound SOAP interceptors

ClassPhaseDescription

CheckFaultInterceptor

POST_PROTOCOL

Checks if the message is a fault message. If the message is a fault message, normal processing is aborted and fault processing is started.

MustUnderstandInterceptor

PRE_PROTOCOL

Processes the must understand headers.

RPCInInterceptor

UNMARSHAL

Unmarshals rpc/literal messages. If the message is bare, the message is passed to a BareInInterceptor object to deserialize the message parts.

ReadsHeadersInterceptor

READ

Parses the SOAP headers and stores them in the message object.

SoapActionInInterceptor

READ

Parses the SOAP action header and attempts to find a unique operation for the action.

SoapHeaderInterceptor

UNMARSHAL

Binds the SOAP headers that map to operation parameters to the appropriate objects.

AttachmentInInterceptor

RECEIVE

Parses the mime headers for mime boundaries, finds the root part and resets the input stream to it, and stores the other parts in a collection of Attachment objects.

DocLiteralInInterceptor

UNMARSHAL

Examines the first element in the SOAP body to determine the appropriate operation and calls the data binding to read in the data.

StaxInInterceptor

POST_STREAM

Creates an XMLStreamReader object from the message.

URIMappingInterceptor

UNMARSHAL

Handles the processing of HTTP GET methods.

SwAInInterceptor

PRE_INVOKE

Creates the required MIME handlers for binary SOAP attachments and adds the data to the parameter list.

Table 63.7, “Outbound SOAP interceptors” lists the interceptors added to a endpoint’s outbound message chain when using the SOAP Binding.

Table 63.7. Outbound SOAP interceptors

ClassPhaseDescription

RPCOutInterceptor

MARSHAL

Marshals rpc style messages for transmission.

SoapHeaderOutFilterInterceptor

PRE_LOGICAL

Removes all SOAP headers that are marked as inbound only.

SoapPreProtocolOutInterceptor

POST_LOGICAL

Sets up the SOAP version and the SOAP action header.

AttachmentOutInterceptor

PRE_STREAM

Sets up the attachment marshalers and the mime stuff required to process any attachments that might be in the message.

BareOutInterceptor

MARSHAL

Writes the message parts.

StaxOutInterceptor

PRE_STREAM

Creates an XMLStreamWriter object from the message.

WrappedOutInterceptor

MARSHAL

Wraps the outbound message parameters.

SoapOutInterceptor

WRITE

Writes the soap:envelope element and the elements for the header blocks in the message. Also writes an empty soap:body element for the remaining interceptors to populate.

SwAOutInterceptor

PRE_LOGICAL

Removes any binary data that will be packaged as a SOAP attachment and stores it for later processing.

XML

Table 63.8, “Inbound XML interceptors” lists the interceptors added to a endpoint’s inbound message chain when using the XML Binding.

Table 63.8. Inbound XML interceptors

ClassPhaseDescription

AttachmentInInterceptor

RECEIVE

Parses the mime headers for mime boundaries, finds the root part and resets the input stream to it, and then stores the other parts in a collection of Attachment objects.

DocLiteralInInterceptor

UNMARSHAL

Examines the first element in the message body to determine the appropriate operation and then calls the data binding to read in the data.

StaxInInterceptor

POST_STREAM

Creates an XMLStreamReader object from the message.

URIMappingInterceptor

UNMARSHAL

Handles the processing of HTTP GET methods.

XMLMessageInInterceptor

UNMARSHAL

Unmarshals the XML message.

Table 63.9, “Outbound XML interceptors” lists the interceptors added to a endpoint’s outbound message chain when using the XML Binding.

Table 63.9. Outbound XML interceptors

ClassPhaseDescription

StaxOutInterceptor

PRE_STREAM

Creates an XMLStreamWriter objects from the message.

WrappedOutInterceptor

MARSHAL

Wraps the outbound message parameters.

XMLMessageOutInterceptor

MARSHAL

Marshals the message for transmission.

CORBA

Table 63.10, “Inbound CORBA interceptors” lists the interceptors added to a endpoint’s inbound message chain when using the CORBA Binding.

Table 63.10. Inbound CORBA interceptors

ClassPhaseDescription

CorbaStreamInInterceptor

PRE_STREAM

Deserializes the CORBA message.

BareInInterceptor

UNMARSHAL

Deserializes the message parts.

Table 63.11, “Outbound CORBA interceptors” lists the interceptors added to a endpoint’s outbound message chain when using the CORBA Binding.

Table 63.11. Outbound CORBA interceptors

ClassPhaseDescription

CorbaStreamOutInterceptor

PRE_STREAM

Serializes the message.

BareOutInterceptor

MARSHAL

Writes the message parts.

CorbaStreamOutEndingInterceptor

USER_STREAM

Creates a streamable object for the message and stores it in the message context.

63.4. Other features

Logging

Table 63.12, “Inbound logging interceptors” lists the interceptors added to a endpoint’s inbound message chain to support logging.

Table 63.12. Inbound logging interceptors

ClassPhaseDescription

LoggingInInterceptor

RECEIVE

Writes the raw message data to the logging system.

Table 63.13, “Outbound logging interceptors” lists the interceptors added to a endpoint’s outbound message chain to support logging.

Table 63.13. Outbound logging interceptors

ClassPhaseDescription

LoggingOutInterceptor

PRE_STREAM

Writes the outbound message to the logging system.

For more information about logging see Chapter 19, Apache CXF Logging.

WS-Addressing

Table 63.14, “Inbound WS-Addressing interceptors” lists the interceptors added to a endpoint’s inbound message chain when using WS-Addressing.

Table 63.14. Inbound WS-Addressing interceptors

ClassPhaseDescription

MAPCodec

PRE_PROTOCOL

Decodes the message addressing properties.

Table 63.15, “Outbound WS-Addressing interceptors” lists the interceptors added to a endpoint’s outbound message chain when using WS-Addressing.

Table 63.15. Outbound WS-Addressing interceptors

ClassPhaseDescription

MAPAggregator

PRE_LOGICAL

Aggregates the message addressing properties for a message.

MAPCodec

PRE_PROTOCOL

Encodes the message addressing properties.

For more information about WS-Addressing see Chapter 20, Deploying WS-Addressing.

WS-RM

Important

WS-RM relies on WS-Addressing so all of the WS-Addressing interceptors will also be added to the interceptor chains.

Table 63.16, “Inbound WS-RM interceptors” lists the interceptors added to a endpoint’s inbound message chain when using WS-RM.

Table 63.16. Inbound WS-RM interceptors

ClassPhaseDescription

RMInInterceptor

PRE_LOGICAL

Handles the aggregation of message parts and acknowledgement messages.

RMSoapInterceptor

PRE_PROTOCOL

Encodes and decodes the WS-RM properties from messages.

Table 63.17, “Outbound WS-RM interceptors” lists the interceptors added to a endpoint’s outbound message chain when using WS-RM.

Table 63.17. Outbound WS-RM interceptors

ClassPhaseDescription

RMOutInterceptor

PRE_LOGICAL

Handles the chunking of messages and the transmission of the chunks. Also handles the processing of acknowledgements and resend requests.

RMSoapInterceptor

PRE_PROTOCOL

Encodes and decodes the WS-RM properties from messages.

For more information about WS-RM see Chapter 21, Enabling Reliable Messaging.