[Coldbox-3.6.0] how to get a list of handler functions.

Does anyone know of a way to get a list or array of handler functions programmatically? Something that might return a list or object back that I could parse through to get the function names.

writeDump( getMetadata( handler ) )


that works on something that is an instance of an object. But I don’t have my handler loaded into an object.

I tried passing the name in and it returned the metadata of the string object i passed in.

Right. It has to be an instance of the object. That’s the only way I’m aware of to get at what you’re wanting to get at.

I suspect it’s undocumented, but there’s probably a way to get at the handlers (objects) from within the CB handler cache.


It’s all “documented” here in our API docs :slight_smile:

If you don’t have an instance of the handler, just use getComponentMetadata() as it only needs the invocation path:
<cfdump var="#getComponentMetaData(“handlers.samples”)#">

If you look at any of the Application templates, they all list out the registered handlers with this code:

    <cfloop list="#getSetting(“RegisteredHandlers”)#" index=“handler”>

  • #handler#

If you want an instance of the handler, just ask the HandlerService to create it for you.

<cfdump var="#controller.getHandlerService().newHandler(“handlers.samples”)#">

Just keep in mind, not all methods in the CFC are necessarily “actions” such as implicit event like preX, postX, aroundX, onError, etc. In addition, there could be additional actions you can can legally call in an event handler that won’t show up in the Metadata by using onMissingAction.

Can you tell us what you’re looking to accomplish?



ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I was testing you. You passed. :smiley: