[Previous][Up][Next] Reference for unit 'HTTPRoute' (#fcl)

HTTP Router Handler Types

The HTTP router supports several different types of handlers, providing flexibility in how you structure your application code. Each handler type serves different architectural needs and complexity levels.

Procedure Callbacks - Simple standalone procedures that accept TRequest and TResponse parameters. This is the most straightforward approach for basic routing needs and stateless operations.

Method Events - Object methods (TRouteEvent) that can access instance data and provide better organization for complex applications with state management. These handlers maintain object context between calls.

Interface Handlers - Objects implementing IRouteInterface provide clean separation of concerns and enable dependency injection patterns. This approach promotes testability and modularity.

Object Class Handlers - Specify a TRouteObjectClass that will be instantiated for each request, providing complete request isolation and automatic memory management. Each request gets a fresh instance.

Extended Callbacks - TRouteCallBackEx procedures that accept additional user data pointer, useful for passing configuration or context information to handlers without global variables.

Choose the handler type based on your application's complexity, state management needs, and architectural preferences. Simple applications can use procedure callbacks, while complex systems benefit from interface or object-based handlers.


Documentation generated on: Jan 27 2026