Front Controller

Luis, I was wondering why most places in ColdBox are happy to assume that the front controller used in ColdBox will always be “index.cfm” but the setNextEvent() method in controller.cfc differs in that it pulls it dynamically like so:

var frontController = listlast(cgi.script_name,"/");

It isn’t hurting anything, but I’m curious why it isn’t consistent with methods like buildLink() in RequestContext.cfc which simply do this:

var frontController = “index.cfm”;



Hmm good observation. What do you think it should be? My gut feeling is changing to index.cfm across the board

I’ve seen frameworks that let you choose your own front controller as a setting, but frankly I’ve never had a need to do so. I think it would be fine to simply slap index.cfm into setNextEvent so it is consistent.


Eek! No!

I’m running everything through coldbox.cfm, so as to not interfere with our legacy system.

Don’t do that! :frowning: please!


Mark, if you do an extended find on coldbox/system you’ll find quite a few references to “index.cfm” in the code. Did you manually find and replace all of those?


Hmnn… I haven’t managed to hit one yet… but maybe it’s because we’re doing some weird stuff, and haven’t managed to run into it yet.

But my 2c is that is should be dynamic, always.

If I want ColdBox to run through foo.cfm, bar.cfm, and gandalf.cfm, it should always work :slight_smile:

More flexible over all for sure.


Damn! I’m switching all my apps to the gandalf.cfm system. Great idea!

LOL, ok, well, can we identify where index.cfm is and change it.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:

I agree. Would be nice flexibility.


For the most part, this can probably be handled nicely with something to the affect of a frontControllerTemplate setting. However, you're going to have a bit of a bootstrapping issue in application.cfc where, once again, the setting won't neccessarily be available before the app is initted. Those gandolf.cfm users out there will still end up having to put "gandalf.cfm" somewhere in their application.cfc so the app can start up. It would be a little redundant to also have it settings file. What if application.cfc put the frontController in application scope somehwere and the loaderService set it as a setting for easy access within the app?

Also, for the record, here are the places I found that I think would need to be updated for ColdBox to support a configurable front controller. I searched the "system" folder of RC1 that I downloaded last night.

\Coldbox.cfc Lines 555 and 557 relocate to debugPanel
\FrameworkSuperType Line 248 cfargument hint
\interceptors\ColdboxSideBar.cfc Lines 208 and 210 side bar link for debug panel and profiler
\interceptors\SES.cfc Line 41 htmlBaseURL configuration
\interceptors\SES.cfc Line 560 checkForInvalidURL method
\interceptors\SES.cfc Lines 789 and 806 regular expression
\web\Controller.cfc Line 375 would need to be updated to use new setting
\web\context\RequestContext.cfc Line 362 getSelf method
\web\context\RequestContext.cfc Line 376 buildLink method
\web\services\DebuggerService.cfc Lines 197, 220, 268, 310, and 385 Setting URLBase variable