preEvent/postEvent Interceptor parameters

Could someone quickly clarify the difference between the two
parameters to a preEvent or postEvent interceptor?

According to http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbInterceptorsGuide
Interceptors accept two parameters, event, and interceptdata. The
event parameter is described as "the event object". In the case of
the preEvent and postEvent interception points, the interceptdata
passed in as the second argument is processedEvent, which is described
as "the event fired".

I know that these interception points fire for all events including
events called via the run event method so therefore there could be two
events in play-- the initial one, and the current one being run.
Which event(s) should I expect in each parameter?

Thanks.

~Brad

Hi Brad,
Try it out! :slight_smile:

The interceptData is a structure that can contain data according to the announced interception. In the case of the preEvent and postEvent interceptors, the processedEvent will be the event executing. So each runEvent() call will create these interception calls if they are defined.

Luis

< Coldbox 2.6.2>

Hi Brad,Try it out! :slight_smile:

Yeah, yeah, I know. I was hoping to be lazy for once :slight_smile:

The interceptData is a structure that can contain data according to the
announced interception. In the case of the preEvent and postEvent
interceptors, the processedEvent will be the event executing. So each
runEvent() call will create these interception calls if they are defined.

That's a good review, but it didn't answer my question.

For the record, line 392 of controller.cfc is in the runevent method
and this line of code prepares the processedEvent data for both the
preevent and postevent interception points:
<cfset interceptMetadata.processedEvent = arguments.event>

arguments.event is a STRING representation of the event name.

So, the arguments.event paramter is a requestContext object
representing the initial event and the arguments.interceptData
parameter is a string representing the actual event about to be ran.

For example, I just registered an interceptor which is listening for
all preEvent interception points. Then I ran a simple test event in
my browser. (ehTest.myTest)
My interceptor was called twice with the following parameters:

event: {object} with FWevnt = ehTest.myTest
proessedEvent: ehMain.onRequestStart

and again with

event: {object} with FWevnt = ehTest.myTest
proessedEvent: ehTest.myTest

That is correct, because the interceptor listens for ANY event not only your requested event. Does this answer your question