Assuming a new session, which event runs first, onRequestStart or onSessionStart?
The answer is in the Application.cfc, so whatever CF fires the order in then the Application.cfc will call the appropriate event.
Regards,
Andrew Scott
Hmm, I don’t think you get a guarantee as I believe onSessionStart runs on a separate thread than a request.
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
Yeah I am not sure there either, that is why I said that the order that Application.cfc fires it in.
Regards,
Andrew Scott
onSessionStart runs first?
When a request executes, ColdFusion runs the CFC methods in the following order:
- (if not run before for this application)
- (if not run before for this session)
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=AppEvents_12.html
- Gabriel
One caveat or gotcha to this is that the ColdBox event specified by the applicationStartHandler config setting (which by default is Main.onAppInit) is NOT run during the ColdFusion onApplicationStart event. It’s actually executed during the ColdFusion onRequestStart event as part of processColdBoxRequest(). (It’s only executed the first time onRequestStart runs.)
This means that for the application’s very first request that code in your ColdBox “onSessionStart” event will run before code in your ColdBox “onAppInit” event. I don’t know if this is by design or not, but it seems counter intuitive to me and feels like a bug.
Good point! I had a ticket for this for such a long time and completely forgot to move it to the loadColdBox() method. Just in time for 3.0 release. It is now done, please verify.
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
Yes, that appears to have resolved the issue! onAppInit is now running before onSessionStart. Thank you!!