Apache CXF API

org.apache.cxf.phase
Class PhaseInterceptorChain

java.lang.Object
  extended by org.apache.cxf.phase.PhaseInterceptorChain
All Implemented Interfaces:
Iterable<Interceptor<? extends Message>>, InterceptorChain

public class PhaseInterceptorChain
extends Object
implements InterceptorChain

A PhaseInterceptorChain orders Interceptors according to the phase they participate in and also according to the before & after properties on an Interceptor.

A List of phases is supplied to the PhaseInterceptorChain in the constructor. This class is typically instantiated from the PhaseChainCache class in this package. Interceptors that are added to the chain are ordered by phase. Within a phase, interceptors can order themselves. Each PhaseInterceptor has an ID. PhaseInterceptors can supply a Collection of IDs which they should run before or after, supplying fine grained ordering.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.cxf.interceptor.InterceptorChain
InterceptorChain.State
 
Field Summary
static String PREVIOUS_MESSAGE
           
 
Fields inherited from interface org.apache.cxf.interceptor.InterceptorChain
STARTING_AFTER_INTERCEPTOR_ID, STARTING_AT_INTERCEPTOR_ID
 
Constructor Summary
PhaseInterceptorChain(SortedSet<Phase> ps)
           
 
Method Summary
 void abort()
           
 void add(Collection<Interceptor<? extends Message>> newhandlers)
          Adds multiple interceptors to the interceptor chain.
 void add(Collection<Interceptor<? extends Message>> newhandlers, boolean force)
           
 void add(Interceptor i)
          Adds a single interceptor to the interceptor chain.
 void add(Interceptor i, boolean force)
           
 PhaseInterceptorChain cloneChain()
           
 boolean doIntercept(Message message)
          Intercept a message, invoking each phase's handlers in turn.
 boolean doInterceptStartingAfter(Message message, String startingAfterInterceptorID)
          Intercept a message, invoking each phase's handlers in turn, starting after the specified interceptor.
 boolean doInterceptStartingAt(Message message, String startingAtInterceptorID)
          Intercept a message, invoking each phase's handlers in turn, starting at the specified interceptor.
static Message getCurrentMessage()
           
 MessageObserver getFaultObserver()
           
 ListIterator<Interceptor<? extends Message>> getIterator()
           
 InterceptorChain.State getState()
           
 Iterator<Interceptor<? extends Message>> iterator()
           
 void pause()
           
 void remove(Interceptor i)
           
 void reset()
           
 void resume()
           
 void setFaultObserver(MessageObserver faultObserver)
           
 void suspend()
           
 String toString()
           
 void unwind(Message message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PREVIOUS_MESSAGE

public static final String PREVIOUS_MESSAGE
Constructor Detail

PhaseInterceptorChain

public PhaseInterceptorChain(SortedSet<Phase> ps)
Method Detail

getCurrentMessage

public static Message getCurrentMessage()

getState

public InterceptorChain.State getState()
Specified by:
getState in interface InterceptorChain

cloneChain

public PhaseInterceptorChain cloneChain()

add

public void add(Collection<Interceptor<? extends Message>> newhandlers)
Description copied from interface: InterceptorChain
Adds multiple interceptors to the interceptor chain.

Specified by:
add in interface InterceptorChain
Parameters:
newhandlers - the interceptors to add to the chain

add

public void add(Collection<Interceptor<? extends Message>> newhandlers,
                boolean force)

add

public void add(Interceptor i)
Description copied from interface: InterceptorChain
Adds a single interceptor to the interceptor chain.

Specified by:
add in interface InterceptorChain
Parameters:
i - the interceptor to add

add

public void add(Interceptor i,
                boolean force)

pause

public void pause()
Specified by:
pause in interface InterceptorChain

suspend

public void suspend()
Specified by:
suspend in interface InterceptorChain

resume

public void resume()
Specified by:
resume in interface InterceptorChain

doIntercept

public boolean doIntercept(Message message)
Intercept a message, invoking each phase's handlers in turn.

Specified by:
doIntercept in interface InterceptorChain
Parameters:
message - the message
Throws:
Exception

doInterceptStartingAfter

public boolean doInterceptStartingAfter(Message message,
                                        String startingAfterInterceptorID)
Intercept a message, invoking each phase's handlers in turn, starting after the specified interceptor.

Specified by:
doInterceptStartingAfter in interface InterceptorChain
Parameters:
message - the message
startingAfterInterceptorID - the id of the interceptor
Throws:
Exception

doInterceptStartingAt

public boolean doInterceptStartingAt(Message message,
                                     String startingAtInterceptorID)
Intercept a message, invoking each phase's handlers in turn, starting at the specified interceptor.

Specified by:
doInterceptStartingAt in interface InterceptorChain
Parameters:
message - the message
startingAtInterceptorID - the id of the interceptor
Throws:
Exception

reset

public void reset()
Specified by:
reset in interface InterceptorChain

unwind

public void unwind(Message message)

remove

public void remove(Interceptor i)
Specified by:
remove in interface InterceptorChain

abort

public void abort()
Specified by:
abort in interface InterceptorChain

iterator

public Iterator<Interceptor<? extends Message>> iterator()
Specified by:
iterator in interface Iterable<Interceptor<? extends Message>>

getIterator

public ListIterator<Interceptor<? extends Message>> getIterator()
Specified by:
getIterator in interface InterceptorChain

toString

public String toString()
Overrides:
toString in class Object

getFaultObserver

public MessageObserver getFaultObserver()
Specified by:
getFaultObserver in interface InterceptorChain

setFaultObserver

public void setFaultObserver(MessageObserver faultObserver)
Specified by:
setFaultObserver in interface InterceptorChain

Apache CXF API

Apache CXF