I'm implementing some stuff in my Struts-based application using interceptors, and I'm getting confused about how their lifecycle works. According to the Struts docs ("Interceptors", "Writing interceptors" and "Big picture"), it should work something like this:
FirstInterceptor NextInterceptor LastInterceptor Action Result LastInterceptor NextInterceptor FirstInterceptor
which makes sense, but I'm stumbling on how to distinguish an interceptor call executing before the action from one executing after the result is rendered (I'm skipping PreResultListener
s here). If I fire up a debugger, I get two calls to (Update: This part was a major confusion on my end, and I was able to answer my question below once I got it)intercept()
and can't find anything too obvious on the ActionInvocation
I'm being passed.
The "Big picture" page talks somewhat confusingly of a "before" and "after" "clause" that are called, but I don't know what to make of it:
[...]
This includes invoking any Interceptors (the before clause) in advance of invoking the Action itself.
[...]
Interceptors are executed again (in reverse order, calling the after clause).
[...]
(Update: These two sentences are still bad, though)