Kitto.Web.Routing.Registry
Resource registry for attribute-based routing. Scans classes decorated with [TKXPath] at registration time, caches RTTI method/parameter info, and provides lookup for the activation engine.
TKXParamInfo record
Cached descriptor for a single method parameter.
TKXMethodInfo class
Cached descriptor for a single handler method.
property RttiMethod: TRttiMethod read FRttiMethod;The RTTI method this descriptor was built from (used to invoke it).
property SubPath: string read FSubPath;The method-level [TKXPath] sub-path (e.g. '/data'); '' if none.
property HttpMethod: string read FHttpMethod;Accepted HTTP method ('GET'/'POST'/…); '' means any ([TKXANY]).
property Params: TArray<TKXParamInfo> read FParams;Cached descriptors of the method's parameters, in declaration order.
property FullPathTokens: TArray<string> read FFullPathTokens;Full path (base + sub) split into tokens, used for URL matching.
property PathTemplate: string read FPathTemplate;Unexpanded full path (base + sub); may contain the '{apibase}' placeholder resolved at runtime by TKXResourceRegistry.ResolveApiBase.
property LiteralCount: Integer read FLiteralCount;Count of literal (non-{param}) tokens; higher = more specific route.
property IsAnonymous: Boolean read FIsAnonymous;True if decorated with [TKXAnonymous] (skips the authentication gate).
property IsNavigable: Boolean read FIsNavigable;True if decorated with [TKXNavigable] (reachable by direct navigation).
property IsNotPublic: Boolean read FIsNotPublic;True if decorated with [TKXNotPublic] (a public view never exempts it from auth).
TKXResourceInfo class
Cached descriptor for a resource class.
constructor Create;Creates the descriptor with an empty (owned) method list.
destructor Destroy;Frees the owned method descriptors.
property ResourceClass: TClass read FResourceClass;The resource (handler) class this descriptor represents.
property BasePath: string read FBasePath;The class-level [TKXPath] base path (e.g. '/kx/view/{ViewName}').
property Methods: TObjectList<TKXMethodInfo> read FMethods;The handler methods discovered on the class (owned).
TKXResourceRegistry class
Singleton registry of all resource classes. Populated at startup via RegisterResource calls in unit initialization sections. Thread-safe for reads (populated before request threads start).
constructor Create;Creates the registry with an empty (owned) resource list.
destructor Destroy;Frees the owned resource descriptors and the RTTI context.
class destructor DestroyClass;Frees the singleton instance at unit finalization.
procedure RegisterResource(AClass: TClass);Scans AClass via RTTI and registers its [TKXPath] handler methods, then re-sorts by specificity. No-op if the class exposes no handler method.
procedure RegisterOverride(AClass: TClass);Registers AClass in place of the framework handler(s) sharing its base [TKXPath], letting an application replace an endpoint by subclassing — without forking the framework. Typical use from UseKitto.pas: type TMyView = class(TKXViewHandlerBase) ... end; TKXResourceRegistry.Instance.RegisterOverride(TMyView); The base path is inherited from the ancestor, and RTTI GetMethods surfaces every inherited route, so only the endpoint(s) actually overridden must re-declare their routing attributes; overrides that only customize virtual hooks (OnBeforeSave, …) need nothing extra.
procedure UnregisterResource(AClass: TClass);Removes the resource registered for AClass, if present.
procedure ResolveApiBase(const ABasePath: string);Expands the '{apibase}' placeholder in every registered route with the configured REST base path (e.g. '/api/v4'), recomputing the match tokens and re-sorting by specificity. Called once by the engine after the config is loaded and before requests are served. Idempotent (re-expands from the stored template) and a no-op for routes without the placeholder.
property Resources: TObjectList<TKXResourceInfo> read FResources;All registered resource descriptors, sorted by descending specificity.
TKXServerLink record
A named link to a server endpoint, shown e.g. in the desktop host UI.
TKXServerLinkRegistry class
Registry of "server links" that opt-in modules publish for the host UI (the VCL MainForm) to display — without the host depending on those units. A module registers a link in its initialization; the host reads the list and expands '{apibase}' with the configured REST base path. Keeps the MainForm free of any hardcoded '/api/v4' string.
class destructor DestroyClass;Frees the link list at unit finalization.
class procedure Register(const ACaption, APathTemplate: string);Publishes a server link (caption + app-relative path template).
class function Links: TArray<TKXServerLink>;The published links, in registration order (empty if none).
TKXOptionalFeatureRegistry class
Registry of optional feature subsystems (Help Chat, Notification Center) that are shipped as opt-in units, i.e. NOT pulled in by Kitto.Html.All. Each such unit declares its feature id in its own initialization; the core reads the flag to fail fast with an actionable message when the feature is enabled in Config.yaml but its unit was not added to the application's UseKitto.pas. Feature ids are case-insensitive.
class procedure Declare(const AFeatureId: string);Declares that the unit providing AFeatureId is linked. Called from that unit's initialization section; idempotent.
class function IsAvailable(const AFeatureId: string): Boolean;True if a unit has declared AFeatureId (i.e. the feature's code is linked into the running binary).
