I just noticed that the configure() method in an event handler is not
called - is that right?
When you have an interceptor, you don't define init() yourself, you
define configure() and the framework calls it.
It seems that with an event handler, even tho' it also extends the
FrameworkSuperType which has configure(), you are supposed to define
init() and call super.init().
If you define configure() in an event handler, it is just ignored.
That seems pretty inconsistent to me and I couldn't confirm from the
documentation what was supposed to happen.
configure() only exists for the context of interceptors, as per the documentation. They are different as the frameworks controls the construction of the interceptors first and then the user can configure them.
Handlers are totally different and do not exhibit the same behavior as interceptors, they are totally different. Thus, configure() has never been part of handlers and nowhere documented that configure() is an aproach for them. However, it is documented that you can override the init() of an event handler so you can do Extra construction items, if you ever so desired.
Luis F. Majano
President
Ortus Solutions, Corp
ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com
Well, configure() exists in FrameworkSuperType.cfc and therefore in
every other ColdBox entity
In certain other frameworks (I'm thinking mostly of Mach-II),
configure() is used consistently in every framework entity as the way
to provide initialization so you don't have to deal with different
init() arguments and calling super.init() appropriately.
Since configure() exists in every ColdBox entity because of the
FrameworkSuperType.cfc, I had hoped that ColdBox would behave in a
similar consistent manner.
Thanx for your clarification that interceptors are the odd one out and
other stuff should use init() - and call super.init() - instead.
If configure() is only applicable to interceptors, you might want to
consider moving it from FrameworkSuperType.cfc down to
Interceptor.cfc.
Configure does not exist in the super type
Ugh! You're right. What was I looking at then, I wonder?
I guess I saw configure() being called for interceptors and the
request context decorator as well as within some plugins and assumed
it was a framework-wide convention like Mach-II.
I've spent all day trawling through the source code trying to figure
out how best to implement user-friendly handling of exceptions and
invalid events because the documentation didn't give me a clear path
for what I was trying to do (it's great for reference material but
it's not always so helpful for the "how do I...?" questions)... so my
brain's kind of overflowing. I've gotten very used to chasing
everything back up to the super type to find out exactly what methods
are available and/or what they (and of course many of them delegate
back down to the controller object)
Sorry!