Brett,
As far as I know, you're the first to actually dig into the event
handlers, so there are probably some improvements that could be made.
I'll try to answer your questions as best I can.
1) There are a couple default ColdMVC event listeners defined for the
requestStart event, namely:
* modelInjector.clearCache()
* scopeManager.addScopes()
* helperManager.addHelpers()
* tagManager.generateTags()
* renderer.generateTemplates()
* paramManager.populateParams()
* flashManager.startRequest()
* filterManager.enableFilters()
* routeHandler.handleRequest()
These events exist to make sure the framework is ready to handle your
request. After these listeners have executed, ColdMVC will execute all
of your application's methods annotated with @events requestStart. As
far as I can tell, you've figured all this out for yourself already.
The preRequest event exists only to fire
metaDataObserver.findObservers(), which will scan your application's
components and find any methods that are expecting to listen for the
requestStart event. If the metaDataObserver was set to listen for
requestStart rather than preRequest, your applicant's event listeners
wouldn't be discovered in time to execute during the requestStart
event. Hopefully that makes some sense. I like to think of the
preRequest event as a private event intended for use by the framework
only. I guess I could move all of the ColdMVC requestStart event
listeners to listen for the preRequest event instead if that would
help eliminate some confusion.
As far as the controller's requestStart events firing after the
execution of the event, I'm a little confused. Can you explain your
scenario a little more? I typically think of the actual "request" as
calling the action then rendering the layout and view.
2) About 2 weeks ago I spent some time cleaning up the event listeners
and in doing so I removed the actionStart and actionEnd events in
favor of preAction and postAction, since they're essentially the same.
A typical request will now broadcast the following events:
* requestStart
* preAction
* preAction:{controller}Controller
* preAction:{controller}Controller.{action}
* postAction:{controller}Controller.{action}
* postAction:{controller}Controller
* postAction
* preLayout
* preLayout:layoutController
* preLayout:layoutController.{layout}
* postLayout:layoutController.{layout}
* postLayout:layoutController
* postLayout
* preView
* preView:{view}.cfm
* postView:{view}.cfm
* postView
* requestEnd
I guess I could still clean up that list a little bit, since preLayout
and preLayout:layoutController are basically the same thing...
Sorry for the confusion. Hopefully that somewhat helps. If you have
any other questions let me know.
Thanks for checking out ColdMVC!
-Tony