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!
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