HandlerAdapterManager class final
Central registry and lifecycle coordinator for all HandlerAdapter instances in the Jetleaf web framework.
The HandlerAdapterManager is responsible for discovering, ordering, and managing all adapters that know how to invoke specific handler types. Each HandlerAdapter encapsulates the logic for invoking a handler — such as a controller method, a functional route, or a framework-defined endpoint — and producing a consistent response for the dispatcher.
Responsibilities
- Discovers all HandlerAdapter Pods registered in the
ApplicationContext. - Allows WebConfigurer implementations to contribute custom adapters.
- Maintains a globally ordered chain of adapters based on
@Orderannotations or programmatic registration sequence. - Provides access to the ordered adapter list for use by dispatchers and resolvers.
Initialization Flow
- During startup, onReady scans the
ApplicationContextfor registered HandlerAdapter Pods. - Invokes WebConfigurer.addHandlerAdapters to register user-defined adapters.
- Sorts all discovered adapters via
AnnotationAwareOrderComparator.
Example
final manager = HandlerAdapterManager();
manager.setApplicationContext(context);
await manager.onReady();
final adapters = manager.getHandlerAdapters();
for (final adapter in adapters) {
print('Loaded adapter: ${adapter.runtimeType}');
}
Typical Use Cases
- Adapting annotated controller methods (e.g.,
@RequestMappinghandlers) - Supporting functional routing DSLs
- Enabling custom handler invocation strategies
See also
- HandlerAdapter
- WebConfigurer
AnnotationAwareOrderComparatorApplicationContext
Constructors
- HandlerAdapterManager()
- Central registry and lifecycle coordinator for all HandlerAdapter instances in the Jetleaf web framework.
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
-
addAdapter(
HandlerAdapter adapter) → void - Registers a new HandlerAdapter with this dispatcher.
-
findSupportingAdapter(
HandlerMethod method) → HandlerAdapter? - Finds a HandlerAdapter capable of handling the specified HandlerMethod.
-
getHandlerAdapters(
) → List< HandlerAdapter> - Returns the ordered list of all registered HandlerAdapter 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
ApplicationContextthat this component runs in. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited