Blog

Brad Wood

September 05, 2012

Spread the word


Share your thoughts

 

ColdBox handlers all support these simple AOP-style methods that require no configuration to get running:
 
  • preHandler Executes before any requested action (In the same handler CFC)
  • pre{Action} Executes before the {action} requested ONLY
  • postHandler Executes after any requested action (In the same handler CFC)
  • post{Action} Executes after the {action} requested ONLY
  • aroundHandler Executes around any request action (In the same handler CFC)
  • around{Action} Executes around the {action} requested ONLY
 
You don't have to do anything other than define these methods and the ColdBox framework will call them for you.  They supply you with a handy method of implementing security, error handling, logging, or whatever else you can dream up to your handlers; even cross-cutting several methods at once!
 
For more info and some example code, look here: http://wiki.coldbox.org/wiki/EventHandlers.cfm#AOP_Simple_Interceptors
 
P.S. {Action} would be the name of the action being run.  For instance, if your handler had a method (action) called "list", the convention would be "preList", "postList", or "aroundList".

Add Your Comment

Recent Entries

BoxLang 1.0.0 Beta 27 Launched

BoxLang 1.0.0 Beta 27 Launched

We are excited to bring you Beta 27 with enhanced XML handling, new CLI app support, improved error handling, and expanded interoperability with Java and CFML runtimes. We've also added new HTTP event hooks, improved caching strategies, and a streamlined class resolution process to make your applications more performant, even in debug modes.

Luis Majano
Luis Majano
January 31, 2025
Into the Box 2025 | Plan Your Trip With Us!

Into the Box 2025 | Plan Your Trip With Us!

Are you ready to join us for Into the Box 2025 from April 30th to May 2nd in Washington, D.C.? Let’s make your trip planning as smooth as possible. Here you’ll find Airfare discounts, Hotel Deals and fun things to do to the the best out of your trip to D.C.

Maria Jose Herrera
Maria Jose Herrera
January 30, 2025