Red Hat DocumentationFuse ESBToggle FramesPrintFeedback

Using Java annotations


Fuse Services Framework provides four Java annotations that allow a developer to specify the interceptor chains used by an endpoint. Unlike the other means of attaching interceptors to endpoints, the annotations are attached to application-level artifacts. The artifact that is used determines the scope of the annotation's effect.

Where to place the annotations

The annotations can be placed on the following artifacts:

  • the service endpoint interface(SEI) defining the endpoint

    If the annotations are placed on an SEI, all of the service providers that implement the interface and all of the consumers that use the SEI to create proxies will be affected.

  • a service implementation class

    If the annotations are placed on an implementation class, all of the service providers using the implementation class will be affected.

The annotations

The annotations are all in the org.apache.cxf.interceptor package and are described in Table 2.

Table 2. Interceptor chain annotations

InInterceptors Specifies the interceptors for the inbound interceptor chain.
OutInterceptors Specifies the interceptors for the outbound interceptor chain.
InFaultInterceptors Specifies the interceptors for the inbound fault interceptor chain.
OutFaultInterceptors Specifies the interceptors for the outbound fault interceptor chain.

Listing the interceptors

The list of interceptors is specified as a list of fully qualified class names using the syntax shown in Example 19.

Example 19. Syntax for listing interceptors in a chain annotation

interceptors={"interceptor1", "interceptor2", ..., "interceptorN"}


Example 20 shows annotations that attach two interceptors to the inbound interceptor chain of endpoints that use the logic provided by SayHiImpl.

Example 20. Attaching interceptors to a service implementation

import org.apache.cxf.interceptor.InInterceptors;

@InInterceptors(interceptors={"com.sayhi.interceptors.FirstLast", "com.sayhi.interceptors.LogName"})
public class SayHiImpl implements SayHi

Comments powered by Disqus