Class InterceptorFlowController
In the trivial setup, an exchange passes through two chains until it hits Outcome.RETURN: The main chain owned by the Transport (containing the RuleMatching, Dispatching, UserFeature and HttpClient-Interceptors) and the inner chain owned by the UserFeatureInterceptor (containing any interceptor configured in proxies.xml).
The HTTPClientInterceptor, the last interceptor in the main chain,
always returns Outcome.RETURN or Outcome.ABORT, never
Outcome.CONTINUE.
Any chain is followed using Interceptor.handleRequest(Exchange) until
it hits Outcome.RETURN or Outcome.ABORT. As the chain is
followed, every interceptor (except those with Interceptor.Flow.REQUEST) are
added to the exchange's stack.
When Outcome.RETURN is hit, the exchange's interceptor stack is
unwound and Interceptor.handleResponse(Exchange) is called for every
interceptor on it.
When Outcome.ABORT is hit, handling is aborted: An
AbortException is thrown. The stack is unwound calling
Interceptor.handleAbort(Exchange) on each interceptor on it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKey intoAbstractExchange.getProperty(String)to find out the reason why some interceptor returned ABORT. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinvokeHandlers(Exchange exchange, List<Interceptor> interceptors) Runs both the request and response handlers: This executes the main interceptor chain.invokeRequestHandlers(Exchange exchange, List<Interceptor> interceptors) Runs the request handlers of the given chain.voidinvokeResponseHandlers(Exchange exchange) Runs all response handlers for interceptors that have been collected on the exchange's stack so far.
-
Field Details
-
ABORTION_REASON
Key intoAbstractExchange.getProperty(String)to find out the reason why some interceptor returned ABORT.This refers to the last interceptor that returned ABORT.
Note that this does not have to be set if ABORT was returned by the interceptor.
- See Also:
-
-
Constructor Details
-
InterceptorFlowController
public InterceptorFlowController()
-
-
Method Details
-
invokeHandlers
Runs both the request and response handlers: This executes the main interceptor chain.- Throws:
Exception
-
invokeRequestHandlers
public Outcome invokeRequestHandlers(Exchange exchange, List<Interceptor> interceptors) throws Exception Runs the request handlers of the given chain. Response handlers are collected as the request handlers are executed and appended to the exchange's interceptor stack for later unwinding.- Throws:
Exception
-
invokeResponseHandlers
Runs all response handlers for interceptors that have been collected on the exchange's stack so far.- Throws:
Exception
-