HandlerInterceptorManager class final

Central registry and lifecycle manager for all HandlerInterceptor instances within the JetLeaf web runtime.

The HandlerInterceptorManager is responsible for discovering, ordering, and managing the set of interceptors that participate in the HTTP request lifecycle. It integrates both framework-defined and user-provided interceptors into a unified execution chain.

Responsibilities

  • Discover and instantiate all HandlerInterceptor Pods registered in the ApplicationContext.
  • Allow developers to contribute additional interceptors via WebConfigurer.
  • Maintain a globally ordered interceptor chain based on @Order annotations or programmatic registration order.
  • Expose a read-only view of the active interceptors for use by the dispatcher.

Interceptor Lifecycle

Interceptors are applied during request processing in two main phases:

  1. Pre-handling phase: Invoked before the handler method is executed (e.g., for authentication, logging, or request enrichment).
  2. Post-handling phase: Invoked after the handler completes (e.g., for response modification, cleanup, or metrics collection).

Initialization Flow

  1. During startup, onReady scans the ApplicationContext for registered HandlerInterceptor Pods.
  2. It also invokes WebConfigurer.addInterceptors to collect user-supplied interceptors.
  3. All collected interceptors are ordered using AnnotationAwareOrderComparator.

Example

final manager = HandlerInterceptorManager();
manager.setApplicationContext(context);
await manager.onReady();

final interceptors = manager.getInterceptors();
for (final interceptor in interceptors) {
  print('Active interceptor: ${interceptor.runtimeType}');
}

See also

Constructors

HandlerInterceptorManager()
Central registry and lifecycle manager for all HandlerInterceptor instances within the JetLeaf web runtime.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getInterceptors() List<HandlerInterceptor>
Returns the ordered list of all registered HandlerInterceptor instances.
getPackageName() String
Represents an abstraction for identifying the package that an object, resource, or service belongs to.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onReady() Future<void>
Interface to be implemented by pods that require initialization logic after their properties have been set by the container.
setApplicationContext(ApplicationContext applicationContext) → void
Sets the ApplicationContext that this component runs in.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited