INTERCEPTORS

ColdBox Interceptors are a powerful feature in the ColdBox HMVC framework that allows you to intercept and modify the behavior of a request throughout its lifecycle. Interceptors act as event-driven components that can be executed before, after, or during a request, giving you fine-grained control over the application flow.

With ColdBox Interceptors , you can perform various tasks such as authentication, authorization, logging, caching, performance monitoring, and more. They provide a clean separation of concerns and help keep your code modular and reusable.

Interceptors image

Easily Announce Events

#announce( 'onSidebar' )#

// Announce inside a function
if( userCreated ){
  announce( 'onUserCreate', { user = prc.oUser } )
}

Easily Listen To Any Event

component extends="coldbox.system.Interceptor"{

  function onError( event, interceptData = {} ){
	// Listen to onError events
  }

  function onUserCreate( event, interceptData = {} ){
	// Listen to onUserCreate events
  }

}

ColdBox Interceptors are easy to configure and integrate into your application. You can define them in your ColdBox configuration file or use annotations within your handler methods. This flexibility allows you to apply interceptors globally, to specific handlers, or even to individual actions within a handler.

In summary, ColdBox Interceptors empower you to intercept and modify the behavior of requests, enabling you to add functionality, enforce security, and enhance the performance of your ColdBox applications. They are a valuable tool for building flexible and maintainable applications in the ColdFusion ecosystem.

You can find much more information about interceptors in the documentation .