cfvonner
04/01/2024, 6:45 PMmethods = "*"
explicitly includes all methods. I don't know if that's the intended design of interceptor functionality. Seems like interceptor-lifecycle methods should not be processed again if included in the methods
argument (or the logic inside the interceptor functionality should explicitly exclude lifecycle methods from being called when the methods
argument is processed).ivan
04/01/2024, 9:40 PMWhen the methods key is missing from the interceptor definition or it contains an empty value or asterisk, then AOP/1 assumes that all methods on the bean should be intercepted.
cfvonner
04/01/2024, 9:46 PMmethods
key is for specifying which methods in your bean are to be intercepted, not which interceptor methods to run. So when you specify *
, it's running the interceptor on any method executed in the bean component (in your case, it appears it's intercepting both the page.before
and page.contatti
methods). That's why it's running twice.ivan
04/01/2024, 9:58 PMpage.cfc
controller, I have:
coldfusion
component accessors=true output=false {
public function before( struct rc ){ }
public function contact( struct rc = {} ) { }
}
And I insert the interceptor configuration like this:
interceptors = [{beanName: "page", interceptorName: "testInterceptor", methods: "*"}]
The interceptor is executed twice:
- The first time for page.before()
- The second time for page.contact()
If in the page.cfc
controller I also had an after()
method, this would also trigger the interceptor again.