on missing handler/method

I would like to create a module, that has an interceptor, that
intercepts onInvalidEvent (the setting within the configuration.cfc).
First is this capable, if so, what is the best approach. I don't see
a standard interception point in the wiki (http://wiki.coldbox.org/
wiki/Interceptors.cfm).

thanks.
Craig

This is on 3.0.0 only: https://www.assembla.com/spaces/coldbox/tickets/1125-new-interception-point–oninvalidevent-that-executes-when-an-invalid-event-is-detected–fires-bef—

I actually just committed it to github.

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

What you can do for now, is create the onInvalidEvent exception handler, and from within it, announce the interception so modules can listen to it.

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

thank you! I just started the project with the 3.0.0 rc1, so by the
time i'm done hopefully 3.0.0 will be out... But to mimic what will be
coming i'll do what you recommended.

I'm working on a coldbox Module that would be the public side of a CMS
where i would like to use the missing event concept. But I'm having
trouble figuring out how to stop the onInvalidEvent handler (or the
throwing of the exception if setting is blank) from executing when the
module's interceptor captures the onInvalidEvent processes.

If you create an onMissingACtion() in your handler that will listen for virtual events, then onInvalidEvent does not fire.

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

I believe I haven't made myself clear in my goal... I would like the
module to extend functionality of the site (and other modules) being
loaded into.

For example,
  I have a testCBSite with the module blog loaded.

testCBSite's configuration has a ModuleRoute added for blog as /blog --

blog.

   testCBSite has a handler general with methods {home}
   blog has handler entry with methods {showAll, showTop, showEntry}

Therefore, the valid routes would be

/testCBSite/index.cfm/general/home
/testCBSite/index.cfm/blog/entry/showAll
/testCBSite/index.cfm/blog/entry/showTop
/testCBSite/index.cfm/blog/entry/showEntry

What I would like to accomplish is to have a module (CMS) that would
watch for invalid events and (if the CMS has it) render the content
from the CMS, no matter what the route is.

For example, the following would be captured by the CMS module and
rendered.
/testCBSite/index.cfm/general/about
/testCBSite/index.cfm/general/contact
/testCBSite/index.cfm/general/directions
/testCBSite/index.cfm/blog/entry/about

(The above, is just the start of how i would like to get it to work w/
in coldBox, i have a lot of ideas of extending the CMS's functionality
so the Site or other Modules can then use the CMS's API to render the
navigation, form labels, form context help, etc} - but those topics
can be discussed at another time)

So based on hopefully what is a clear goal now, how would this be
accomplished within coldBox.. I believe the use of the interceptor is
the correct approach, but finding the right interception point and the
right logic to determine that it will be an InvalidEvent is where i'm
struggling to find the solution.

PS. Like I've said before, great job on coldbox and the support
behind coldbox.

Ahhh now I get it!!

First of all, thank you for laying out the problem very concisely and to the point. Makes it really easy for us to give advice and help on! Thanks!

Second, I believe you are looking at using the “onInvalidEvent” interception point. This point is availabe from RC2 which is in incubation at github at this point. This will give you an interception point that will give you the invalid event execution.

This interception point receives the following in the interceptData

  • invalidEvent : The invalid event string
  • ehBean : An event handler bean (coldbox.system.beans.EventHandlerBean) that will be used to override the execution
  • override flag, must be set to TRUE to take over execution.

So if you want to take over the invalid event, you must first set the override flag in the interceptData to true and then configure the ehBean with the correct executions via its methods: ex:

ehBean.setHandler( handler );
ehBean.setMethod( method );
ehBean.setModule( module );

etc.

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

That sounds awesome, the next chance I get… I’ll be sure to pull the code from GITHUB and start trying it out!!

Thanks, to you and your group, for all the great work

Luis or anyone else working on this,
   I'm not sure if I'm following the code perfectly, but i believe
there is still an issue.

   As described in my previous post, the setup i have is a testSite w/
a testModule which has an interceptor that it listening for
"onInvalidEvent" within there I am doing the following

      <cfset arguments.interceptData.ehBean.setHandler("render") />
      <cfset arguments.interceptData.ehBean.setMethod("page") />
      <cfset arguments.interceptData.ehBean.setModule("availCMS") />

but i'm receiving the error

      Application Execution Exception
      Error Type: Application : [N/A]
      Error Messages: Could not find the ColdFusion Component or
Interface testSite.handlers.render.
      Ensure that the name is correct and that the component or
interface exists.

notice it says "testSite.handlers.render" - but I'm setting the
handler in the module

I believe this is occuring because it is using ehBean.getRunnable()
later which uses the invocationPath which never gets updated.

I hope this helps... And I hope i'm using it right :wink:

PS. Today I pulled the latest code from the nightly build on your
website.

You are missing the invocation path:

HandlerBean.setInvocationPath(moduleSettings[moduleReceived].handlerInvocationPath);

here is an example

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