Missing event handler in external location

RC1

The HandlerService does now allow the onInvalidEvent to exist in the external handler’s location for missing handlers. It does, however work for missing events.

For instance, my onInvalidEvent exists in my external handlers location.

Let’s assume for the sake of the example that ehMain is an existing handler.

If I try to go to index.cfm/ehMain/foobardoesnotexist then I correctly get taken to my onInvalidEvent handler. This is because getRegisteredHandler() has not been run yet, and the framework has not decided where the handler CFC exists.

However, if I try to go to index.cfm/notgonnafindme/foobardoesnotexist then an error is thrown on the first line of the newHandler() method when it tries to create the handler object because onInvalidEvent blindly overwrote the handler and method properties of the event handler bean with checking whether or not the handler was in the external location. I don’t know if you’ll agree, but my fix was to change the last line of the getRegisteredHandler() method to recurse back into itself with the newly overridden handler and method and repeat all of its logic on the new event. This would also make it possible for your onInvalidEvent to be part of a module as well.

Changed last line of getRegisteredHandler from this (with new comment):
// onInvalidEvent detected, so just return the overriden bean
return handlerBean;

To this…

// onInvalidEvent detected, so start over with the overriden handler and method
return getRegisteredHandler(handlerBean.getHandler() & “.” & handlerBean.getMethod());

I can create a GIT pull request for this, but please be patient-- I’ve been so busy I still haven’t done so with my last suggestion :slight_smile:

Thoughts?

Thanks!

~Brad

Hi Brad,

I think this is a winner. I will add this tonight.

Yea take yoiur time, you will see how fun it is to collaborate with git.

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

Brad,

Did you revise using the latest on github or RC1?