Blog

Brad Wood

January 11, 2013

Spread the word


Share your thoughts

 

If you've ever wanted to modify any behavior of the core ColdBox controller, you can now do so as of version 3.5.3 with the Controller Decorator feature.  This is accomplished much like the Request Context Decorator.
 
First, add a configuration setting called "ControllerDecorator" in the coldbox struct of your config file.  
 
/config/ColdBox.cfc
coldbox.controllerDecorator = "path.to.myControllerDecotrator";
 
Next, build your decorator as a CFC that extends our base coldbox.system.web.ControllerDecorator class like so.
 
/path/to/myControllerDecotrator.cfc
component extends="coldbox.system.web.ControllerDecorator"{
 
    function setNextEvent(){
        arguments.ssl = true;
        getController.setNextEvent( argumentCollection=arguments );
    }
 
}
 
That example would wrap the setNextEvent method and force it to always redirect to a secure URL.
 
 
P.S. Instead of extending a class with a super reference, the decorator pattern composes the original object in an invisible wrapper class which contains a reference to the original.  In your controller decorator, you can use the getController() method to get the original controller object.

Add Your Comment

Recent Entries

One Language, Every Runtime: BoxLang Expands Beyond the Server

One Language, Every Runtime: BoxLang Expands Beyond the Server

Discover how BoxLang’s multi-runtime architecture helps developers build beyond the server with support for serverless functions, desktop applications, CI/CD workflows, Java integrations, containers, runtime management, and more.

Maria Jose Herrera
Maria Jose Herrera
June 04, 2026
MatchBox and WebAssembly: Running BoxLang in the Browser and at the Edge

MatchBox and WebAssembly: Running BoxLang in the Browser and at the Edge

The MatchBox open beta is live at https://boxlang.ortusbooks.com/boxlang-framework/matchbox, and it brings something genuinely new to the BoxLang ecosystem: a path into WebAssembly.

That means BoxLang code can now move into browser applications, static-site deployments, edge runtimes, and WASI-style containers - without requiring a JVM. The feature is still beta, but the core direction is already useful: write BoxLang, compile it with MatchBox, and ship the generated WASM artifact to wherever a small portable runtime makes sense.

Jacob Beers
Jacob Beers
June 04, 2026
BoxLang 1.14.0 : BoxSet is Here: BoxLang's New First-Class Set Type

BoxLang 1.14.0 : BoxSet is Here: BoxLang's New First-Class Set Type

BoxLang 1.14.0 ships something that JVM developers have wanted for a long time: a true first-class Set type baked directly into the language. Not a wrapper you reach for manually, not a createObject( "java", "java.util.HashSet" ) incantation you paste from a Stack Overflow answer years ago. A real BoxSet with literal syntax, operator overloads, a full functional pipeline, change listeners, JSON serialization, and deep Java interop.

Luis Majano
Luis Majano
June 03, 2026