Package org.apache.cxf.phase
Class PhaseInterceptorChain
java.lang.Object
org.apache.cxf.phase.PhaseInterceptorChain
- All Implemented Interfaces:
Iterable<Interceptor<? extends Message>>
,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
Fields inherited from interface org.apache.cxf.interceptor.InterceptorChain
STARTING_AFTER_INTERCEPTOR_ID, STARTING_AT_INTERCEPTOR_ID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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<? extends Message> i) Adds a single interceptor to the interceptor chain.void
add
(Interceptor<? extends Message> i, boolean force) 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
ListIterator<Interceptor<? extends Message>>
getState()
Iterator<Interceptor<? extends Message>>
iterator()
void
pause()
Pauses the current chain.void
void
void
remove
(Interceptor<? extends Message> i) void
reset()
void
resume()
Resumes the chain.static boolean
setCurrentMessage
(PhaseInterceptorChain chain, Message m) void
setFaultObserver
(MessageObserver faultObserver) void
suspend()
Suspends the current chain.toString()
void
unpause()
If the chain is marked as paused, this will JUST mark the chain as in the EXECUTING phase.void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
PREVIOUS_MESSAGE
-
-
Constructor Details
-
PhaseInterceptorChain
-
-
Method Details
-
getCurrentMessage
-
setCurrentMessage
-
getState
- Specified by:
getState
in interfaceInterceptorChain
-
releaseAndAcquireChain
public void releaseAndAcquireChain() -
releaseChain
public void releaseChain() -
cloneChain
-
add
Description copied from interface:InterceptorChain
Adds multiple interceptors to the interceptor chain.- Specified by:
add
in interfaceInterceptorChain
- Parameters:
newhandlers
- the interceptors to add to the chain
-
add
-
add
Description copied from interface:InterceptorChain
Adds a single interceptor to the interceptor chain.- Specified by:
add
in interfaceInterceptorChain
- Parameters:
i
- the interceptor to add
-
add
-
pause
public void pause()Description copied from interface:InterceptorChain
Pauses the current chain. When the stack unwinds, the chain will just return from the doIntercept method normally.- Specified by:
pause
in interfaceInterceptorChain
-
unpause
public void unpause()Description copied from interface:InterceptorChain
If the chain is marked as paused, this will JUST mark the chain as in the EXECUTING phase. This is useful if an interceptor pauses the chain, but then immediately decides it should not have done that. It can unpause the chain and return normally and the normal processing will continue.- Specified by:
unpause
in interfaceInterceptorChain
-
suspend
public void suspend()Description copied from interface:InterceptorChain
Suspends the current chain. When the stack unwinds, the chain back up the iterator by one (so on resume, the interceptor that called pause will be re-entered) and then throw a SuspendedInvocationException to the caller- Specified by:
suspend
in interfaceInterceptorChain
-
resume
public void resume()Description copied from interface:InterceptorChain
Resumes the chain. The chain will use the current thread to continue processing the last message that was passed into doIntercept- Specified by:
resume
in interfaceInterceptorChain
-
doIntercept
Intercept a message, invoking each phase's handlers in turn.- Specified by:
doIntercept
in interfaceInterceptorChain
- Parameters:
message
- the message- Throws:
Exception
-
doInterceptStartingAfter
Intercept a message, invoking each phase's handlers in turn, starting after the specified interceptor.- Specified by:
doInterceptStartingAfter
in interfaceInterceptorChain
- Parameters:
message
- the messagestartingAfterInterceptorID
- the id of the interceptor- Throws:
Exception
-
doInterceptStartingAt
Intercept a message, invoking each phase's handlers in turn, starting at the specified interceptor.- Specified by:
doInterceptStartingAt
in interfaceInterceptorChain
- Parameters:
message
- the messagestartingAtInterceptorID
- the id of the interceptor- Throws:
Exception
-
reset
public void reset()- Specified by:
reset
in interfaceInterceptorChain
-
unwind
-
remove
- Specified by:
remove
in interfaceInterceptorChain
-
abort
public void abort()- Specified by:
abort
in interfaceInterceptorChain
-
iterator
- Specified by:
iterator
in interfaceIterable<Interceptor<? extends Message>>
-
getIterator
- Specified by:
getIterator
in interfaceInterceptorChain
-
toString
-
getFaultObserver
- Specified by:
getFaultObserver
in interfaceInterceptorChain
-
setFaultObserver
- Specified by:
setFaultObserver
in interfaceInterceptorChain
-