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
Hands-On QA with BxPlaywright: From a User Workflow to a Browser Test
Join Tom Buettell for a one-hour BxPlaywright webinar. Using a simple to-do app, Tom will show how he decides what’s worth automating, tests whether a task survives a page reload, and uses a failing trace to tell a test issue from an application bug.
BoxLang AI 3.8.0: OAuth for MCP, and Memory That Knows Who's Talking
Ortus Solutions today announces BoxLang AI 3.8.0, the release that makes multi-user AI applications a first-class citizen. Your agents can now sign in to OAuth-protected MCP servers on behalf of each person who talks to them, and every memory type keeps each user and conversation apart. Provider settings finally behave the way the docs always said, and a batch of MCP server fixes lands with it.
BoxLang ORM 2.0 and cborm 6: Hibernate 7 Dynamically Supercharged
🎉 The biggest release in the history of BoxLang's ORM is here. BxORM 2.0 leaps from Hibernate 5.6 straight to Hibernate ORM 7.4, and cborm 6 lands with it, rebuilt on the new engine.
Add Your Comment