Is it safe to get ActionInvocation inside of [Interceptor.intercept()] in this way?:
ActionInvocation invocation = ActionContext.getContext().getActionInvocation(); Alex Siman wrote: > > Is there any way to refactor method [intercept(ActionInvocation)] to > remove ActionInvocation parameter. It is not usable to have this > parameter, because it makes refactoring of method interceptor hard. > > Instead of this: > > public class SomeInterceptor extends AbstractInterceptor > { > @Override > public String intercept(ActionInvocation actionInvocation) throws > Exception > { > oneMethod(actionInvocation); > anotherMethod(actionInvocation); > return actionInvocation.invoke(); > } > > public void oneMethod(ActionInvocation actionInvocation) throws > Exception > { > // code depended on actionInvocation > } > > public void anotherMethod(ActionInvocation actionInvocation) throws > Exception > { > // code depended on actionInvocation > } > } > > I would like to have this one: > > public class SomeInterceptor extends AbstractInterceptor > { > @Override > public String intercept() throws Exception > { > // get actionInvocation from somewhere > oneMethod(); > anotherMethod(); > return actionInvocation.invoke(); > } > > public void oneMethod() throws Exception > { > // get actionInvocation from somewhere > } > > public void anotherMethod() throws Exception > { > // get actionInvocation from somewhere > } > } > > -- View this message in context: http://www.nabble.com/Refactoring-of-Interceptor.intercept%28ActionInvocation%29-tp25779342p25779697.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org