setNextEvent & postProcessExempt

I was troubleshooting an issue with setNextEvent and some of my
interceptors not being called and got a little confused.

In my case it's the postProcess event that wasn't firing. Digging
into the controller.setNextEvent() I saw that there was an attribute
called postProcessExempt defaulting to false with the hint "Do not
fire the postProcess interceptors"

I'm not sure if this is a bug or just bad naming/description but I
assumed that by "exempt" it meant that if this argument was true, that
setNextEvent would bypass the postProcess state.

But looking at the code it is actually opposite, the default (false)
setNextEvent will bypass your postProcess state.

The implication is that if I put any logging, etc in my postProcess
that none of that would be run when setNextEvent was used in my
handlers.

I guess what I am saying is that I'm hoping this is a bug and:

      // Post Processors
      if ( arguments.postProcessExempt ){
        services.interceptorService.processState("postProcess");
      }

should really be (added NOT):

      // Post Processors
      if ( NOT arguments.postProcessExempt ){
        services.interceptorService.processState("postProcess");
      }

99% of the time I would want my postProcessors to run on every
request, so it would be a pain to have to write in the attribute
postProcessExempt=true on every setNextEvent call. At the very least
though, the attribute is named incorrectly for what it does.

thoughts?

Also am I correct in saying that the postEvent state will never be
processed for any request that has calls a setNextEvent()?

.brett

Absolutely right, duhhh!! Thanks for the quick eyes!!

You are a machine!

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

You are a machine!

I'm a machine??? That's like the sun calling the earth BIG. lol.

On the topic of interception points, why some of the CF application
events were CB interception points and others aren't. ColdBox defines
interception points for applicationEnd, sessionStart, sessionEnd but
not the others. Was there a reason for this? It'd be cool to be able
to add interceptors to some of the other app events.

Yeah I realize I could wire them into my application.cfc but was
curious why it wasn't built in into Coldbox.cfc.

thanks!

.brett

hmm, like which ones, I think all of them are available.

It looks like CB only defines applicationEnd, sessionStart, sessionEnd
as interception points so... I was asking why the rest of them were
not added in.

specifically these would be useful - onApplicationStart, onRequest,
onRequestStart, onRequestEnd, onMissingTemplate

There is a requestStartHandler, requestEndHandler,
MissingTemplateHandler, etc.. but that looks like it only runs a
single event. I'd prefer to define an onRequestStart interceptor and
then just call runEvent() inside it. Convention over configuration,
ftw.

I'm not saying anything is wrong, more of a general question - why
those application.cfc events are not bound to the InterceptionService
like you have done with the SessionStart and SessionEnd interceptors.

make sense?

  • onRequestStart and End are basically preProcess and postProcess
  • missing template I have not done,
  • onRequest(), would there be a use here?
  • onCFCRequest(), would there be a use here?
  • onApplicationStart() you already have afterConfigurationLoad and afterAspectsLoad