ColdBox Mode Listener
Argument
Type
Execution Mode
Description
event
coldbox.system.web.context.RequestContext
coldbox
The request context of the running request
interceptData
struct
standalone-coldbox
The data structure passed in the event
buffer
coldbox.system.core.util.RequestBuffer
ColdBox
A request buffer object for producing elegant content in ColdBox applications
rc
struct
coldbox
Reference to the rc scope
prc
struct
coldbox
Reference to the prc scope
So let's say that we want to listen on the beforeInjectorShutdown and on the afterInstanceCreation event in our listener.
1
component{
2
3
function configure(){}
4
5
function beforeInjectorShutdown(event, interceptData, buffer, rc, prc ){
6
var injector = arguments.interceptData.injector;
7
// Do my stuff here:
8
9
// I can use a log object because ColdBox is cool and injects one for me already.
10
log.info("DUDE, I am going down!!!");
11
}
12
13
function afterInstanceCreation(event, interceptData, buffer, rc, prc ){
14
var injector = arguments.interceptData.injector;
15
var target = arguments.interceptData.target;
16
var mapping = arguments.interceptData.mapping;
17
18
log.info("The object #mapping.getName()# has just been built, performing my awesome AOP processing on it.");
19
20
// process awesome AOP on this target
21
processAwesomeAOP( target );
22
}
23
}
Copied!
Copy link
Edit on GitHub