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 AI v2: Enterprise AI Development Without the Complexity
One Year. 100+ Features. Unlimited Possibilities.
Just one year ago, in March 2024, we launched BoxLang AI 1.0. Today, we're thrilled to announce BoxLang AI v2—a massive leap forward that positions BoxLang as the most powerful and versatile AI framework on the JVM.
CommandBox: A Smarter Foundation for BoxLang and CFML Workflows
In day-to-day development, some tools simply do their job… and others quietly change the way you work. CommandBox falls into the second category.
It doesn’t replace your editor, framework, or existing applications. Instead, it becomes the common ground where CFML and BoxLang development meet ,giving teams a consistent, reliable way to build, run, and evolve their projects.
BoxLang v1.9.0 : Production-Ready Stability, Enhanced Lifecycle Management, and Rock-Solid Reliability
Happy New Year! The BoxLang team is excited to announce BoxLang 1.9.0, a significant stability and compatibility release focused on production-readiness thanks to our client migrations and new application deployments. This release also introduces array-based form field parsing conventions, enhanced datasource lifecycle management, improved context handling, and resolves over 50 critical bugs to ensure enterprise-grade reliability for mission-critical applications.
Add Your Comment