struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Law <andy....@roslin.ed.ac.uk>
Subject Interceptor order
Date Tue, 18 May 2010 16:10:13 GMT

Following on from my previous question
(http://old.nabble.com/Some-Spring-Struts-questions-td28533505.html) about
injecting objects orthogonal to actions into the environment where jsps can
"see" them, I now have an interceptor that does what I want it do (Yay! -
thanks guys).

However, I'm seeing some peculiar behaviour that I don't understand fully.

The pertinent code in the interceptor is reproduced below. It does what I
expect it to do insofar as it sticks my "Stuff" object in a place that the
JSP can retrieve it using the MAGIC_KEY string. However, if I configure my
interceptor stack with this interceptor at the top, none of the other
interceptors appear to fire. If I put this interceptor last in the stack,
all of the others do seem to fire (well, the application works). Why should
I need to put this after all the params-prepare-params stuff?



    public String intercept(ActionInvocation invocation) throws
            Exception {

        if (this.getStuff() != null) {
            ActionContext ic = invocation.getInvocationContext();
            if (ic != null) {
                ValueStack vs = ic.getValueStack();
                if (vs != null) {
                    vs.set(MAGIC_KEY, this.getStuff());
                }
            }
        }
        return invocation.invoke();
    }



As always, any and all help/pointers gratefully accepted, particularly if
I'm doing something stupid!

Later

Andy


-- 
View this message in context: http://old.nabble.com/Interceptor-order-tp28597967p28597967.html
Sent from the Struts - User mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message