Controller decoration

Is there a was to decorate the Controller? Perhaps something similar to the method provided for decorating the Request Context? I want to override the behavior of getSetting throughout my app. I’ve seen the example at but that would seem to be a way to do this in a single component.


As far as I know, no. You could create a utility method called myGetSetting that you proxied all your calls through but that wouldn’t affect when the framework called getSetting.

Can you explain to us how you are wanting to modfiy the behavior? We might be able to suggest another alternative.




The application is an api, I have a number of config variables in the settings={} part of the Coldbox.cfc config. The need now arises to allow some but not all of these config variables to be modified by the user on a per-session basis. My thinking was to have get/set api services and then overload getSetting something like this (psuedo code)

/*overloaded getSetting */
getSetting(name) {
return(sessionStoragePlugin.getVar(name=name, default=super.getSetting(name)))

/* callable via the api */
remoteSetSetting(name,value) {
if (inList(allowedViaAPI))

/* callable via the api */
remoteGetSetting(name) {
if (inList(allowedViaAPI))
getSetting(name) //via the overloaded getSetting

This would allow my internal calls to getSetting to see changes made via the API. At the moment, it wouldn’t actually matter if framework calls to getSetting didn’t see my version since the framework wouldn’t be looking in settings={}. However, to do so would at least allow the possibility of API modification of any allowed variable in Coldbox.cfc. I don’t make any internal calls to setSetting so my code above doesn’t show that as overloaded.


If it was me I would use an interceptor, and grab the data from another source like a database. And populate your settings in here on a per user/session basis rather than the way you are thinking.

You have to remember that the config settings is loaded on application startup, and can be modified on a per session basis. But when you do it will be a global change, to avoid a global change you would / should look at another option like I have described.


Andrew Scott