LibraryToggle FramesPrintFeedback

Example 21.14 shows code for adding a handler chain to a consumer.

Example 21.14. Adding a Handler Chain to a Consumer

import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.Handler;
import java.util.ArrayList;
import java.util.List;

import org.apache.cxf.jaxws.binding.DefaultBindingImpl;
...
SmallNumberHandler sh = new SmallNumberHandler(); 1
List<Handler> handlerChain = new ArrayList<Handler>(); 2
handlerChain.add(sh); 3

DefaultBindingImpl binding = ((BindingProvider)proxy).getBinding(); 4
binding.getBinding().setHandlerChain(handlerChain); 5

The code in Example 21.14 does the following:

1

Instantiates a handler.

2

Creates a List object to hold the chain.

3

Adds the handler to the chain.

4

Gets the Binding object from the proxy as a DefaultBindingImpl object.

5

Assigns the handler chain to the proxy's binding.

Comments powered by Disqus
loading table of contents...