The methods in your handlers (actions) have always accepted the "event" object, which is the request context for that event and contains things like the request collection and private request collection.
A common handler method used to look like this:
function index(event) {
var rc = event.getCollection();
var prc = event.getCollection(private=true);
// Do Stuff
}
Remember, if you're using ColdBox 3.1 or higher, every action is now passed a reference to the request collection (rc) and private request collection (prc) as arguments so you don't have to get them yourself.
function index(event,rc,prc){
rc.foo = "Isn't this convenient?";
prc.bar = "Yes, yes it is.";
}
Remembering this tip can help clean up your code by omitting those uneccessary boilerplate lines of code to get the rc and prc.
More info here: http://wiki.coldbox.org/wiki/EventHandlers.cfm#Anatomy_of_an_Event_Handler_Action
Blog
Recent Entries
BoxLang 1.0.0 Beta 23 Launched
The latest release of BoxLang, Beta 23, marks a significant step forward in our journey to create the ultimate dynamic language for the JVM. Packed with powerful new features, important bug fixes, and thoughtful optimizations, this update is designed to make your development experience smoother, faster, and more reliable, especially after now starting to take 100s of comments and bug reports from our community.
TestBox Latest Updates and News!
We’re thrilled to have launched the new TestBox website and TestBox 6.0! If you haven’t had a chance to explore yet, visit TestBox to discover updated documentation, powerful resources, and features that make testing more efficient than ever.
Is Your ColdFusion Application Ready for the Future?
In a rapidly evolving digital world, maintaining performance, security, and scalability for ColdFusion applications is more challenging than ever. Whether you're using Lucee or Adobe ColdFusion, legacy systems can become a bottleneck for growth, innovation, and user satisfaction. The need to future-proof your ColdFusion applications has never been more critical.
But where do you start?
The Hidden Costs of an Outdated ColdFusion Application
As you...
Add Your Comment