WW-5610 Extend Struts 7 forwards compat to more interceptors#1565
WW-5610 Extend Struts 7 forwards compat to more interceptors#1565kusalk merged 1 commit intorelease/struts-6-8-xfrom
Conversation
|
| public String intercept(ActionInvocation invocation) throws Exception { | ||
| if (applyInterceptor(invocation)) { | ||
| return doIntercept(invocation); | ||
| if (applyInterceptor((org.apache.struts2.ActionInvocation) invocation)) { |
There was a problem hiding this comment.
It's a little tricky to follow at first, but we call into #applyInterceptor(struts2.ActionInvocation) which itself calls into #applyInterceptor(xwork2.ActionInvocation). Thus an extending class can override either of these methods and it will still have the intended overriding effect.
Thus legacy applications which are still overriding #applyInterceptor(xwork2.ActionInvocation) will continue to work with no changes required. And applications that wish to prepare for Struts 7 can update their override to the new method signature.




WW-5610
Enables applications which override methods on these classes to do so by overriding the legacy method signatures or the new ones used in Struts 7.x.
The purpose of this change is to allow more applications running Struts 6.x to merge changes required to adopt Struts 7.x in smaller chunks.
We achieve this cross-compatibility by adapting and delegating from the new signatures to the old signatures, meaning irrespective of which methods are overridden, as long as it is consistent, the interceptor will still behave as expected. Please also see my code comment below.
These classes have existing test coverage which ensures that the original code still flows as expected.