Table of Contents

THttpDispatcher Class

Holds a collection of HTTP server modules and routes each incoming request to the module matching its URI.

Remarks

The dispatcher is the bridge between an HTTP server implementation, which receives the raw requests, and the server modules, which process them. Among the modules whose base URI segments prefix the request URI, the one with the most specific (longest) base URI is chosen.

Syntax

Unit: Sparkle.HttpServer.Dispatcher

THttpDispatcher = class(TObject);

Constructors

Name Description
Create Creates a new dispatcher with no modules registered.

Methods

Name Description
AddModule Registers a module to process the requests addressed to its base URI.
ClearModules Removes and destroys all registered modules.
DispatchRequest Processes an incoming request: routes it to the module matching its URI and makes sure a response is always sent.
RemoveModule Removes a previously registered module from the dispatcher, destroying it.

Properties

Name Description
LogEngine Gets or sets the log engine that receives the dispatcher error messages.
ModulesInfo The collection of registered modules, each associated with its base URI.