Haven't used interceptors in FW1, so I'm just gues...
# fw1
c
Haven't used interceptors in FW1, so I'm just guessing here - using
methods = "*"
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).
i
I have read from this documentation: https://framework-one.github.io/documentation/4.3/using-aop-one/
When 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.
c
OK, from reading those docs, it appears that the
methods
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.
🎉 1
i
Great, this is exactly the solution, thank you! :) So, in my
page.cfc
controller, I have:
Copy code
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.