Prepare interceptor: prepare methods invocation order should be reversed
------------------------------------------------------------------------

                 Key: WW-2174
                 URL: https://issues.apache.org/struts/browse/WW-2174
             Project: Struts 2
          Issue Type: Improvement
          Components: Interceptors
    Affects Versions: 2.0.9
         Environment: xwork
            Reporter: Nicolas Romanetti



  Hello,

before the actionMethodName() is called, the prepare interceptor calls
prepare<ActionMethodName>()  and then prepare()

First usage pattern is: I do not need prepareXxxx, I use only prepare
2d usage pattern is: I do need prepareXxxx, but I do not need prepare at all, 
so my prepare method simply does nothing
3d usage pattern is: I need both 

Usage patterns 1 and 2 are OK, however the 3d pattern usage is in my opinion 
not well supported by this interceptor.

You need such a feature when your action class regroups several action methods 
and you need to factorize some preparation.
In my opinion, the factorized preparation, prepare(), should be called first 
and not after the specialized preparation, prepareXxx(). 

Indeed, prepare is not supposed to be aware of the action method called, so it 
cannot really do something useful in between 
prepare<actionMethodName>() and the actionMethodName() itself.
However, if called before, the prepare<actionMethodName>() could benefit from 
it.

I suggest to simply reverse the calling order. I understand this would be a 
major change. We could simply make it configurable...

Regards,
Nicolas.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to