TROMessageDispatchers
Overview
The TROMessageDispatchers class is used by the TROServer as a collection to store one or more dispatchers for use with the server channel. The collection of TROMessageDispatchers contains references to the TROMessage instance to use. There also is a specialized version of the dispatcher class for HTTP Servers (TROHTTPMessageDispatchers) that includes a Path property.
It is unlikely that you will need to use this class directly until you wish implement custom dispatching
rules. The FindDispatcher method lets you implement various strategies based on combinations of IROTransports and streams.
If you wish implement custom dispatching rules, you need implement your custom TROMessageDispatchers descendant and customize a class derived from the TROServer to override the GetDispatchersClass method to return your custom class.
Location
- Unit: uROServer.pas
- Ancestry: TCollection | TROMessageDispatchers
constructor Create virtual
Creates a new instance.
constructor Create(aServer: TROServer)
Parameters:
- aServer: Server component the dispatchers are needed for
CleanReferences
Clears all references to the given aMessage of all dispatchers.
procedure CleanReferences(aMessage: TROMessage)
Parameters:
- aMessage:
DispatcherByName
Returns the dispatcher with the given name or NIL. The search is not case-sensitive.
function DispatcherByName(const aName: string): TROMessageDispatcher
Parameters:
- aName: Dispathcher name to look up
Dispatchers
Indexed property, provides access to dispatchers stored in the collection by index.
property Dispatchers[Index: Integer]: TROMessageDispatcher read
FindDispatcher
Returns the dispatcher which CanHandleMessage for the given transport
and stream
.
function FindDispatcher(const aTransport: IROTransport; aRequestStream: TStream): TROMessageDispatcher
Parameters:
- aTransport:
- aRequestStream:
FindDuplicate
Finds the dispatcher with the given message
.
function FindDuplicate(aMessage: TROMessage): TROMessageDispatcher
Parameters:
- aMessage:
GetDispatcherClass protected virtual
Returns TROMessageDispatcher by default.
The TROHTTPMessageDispatchers overrides it to return TROHTTPDispatcher.
function GetDispatcherClass: TROMessageDispatcherClass
GetSupportsMultipleDispatchers protected virtual
Indicates whether multiple dispatchers can be supported by the channel (multiple dispatchers are not supported by the majority of channels, HTTP ones are the exception). Returns false by default.
function GetSupportsMultipleDispatchers: Boolean
Server protected
Returns the server component the dispatchers are needed for.
property Server: TROServer read
SupportsMultipleDispatchers
False by default. The TROHTTPMessageDispatchers overrides it to True.
property SupportsMultipleDispatchers: Boolean read
Dispatchers
Indexed property, provides access to dispatchers stored in the collection by index.
property Dispatchers[Index: Integer]: TROMessageDispatcher read
Server protected
Returns the server component the dispatchers are needed for.
property Server: TROServer read
SupportsMultipleDispatchers
False by default. The TROHTTPMessageDispatchers overrides it to True.
property SupportsMultipleDispatchers: Boolean read
constructor Create virtual
Creates a new instance.
constructor Create(aServer: TROServer)
Parameters:
- aServer: Server component the dispatchers are needed for
CleanReferences
Clears all references to the given aMessage of all dispatchers.
procedure CleanReferences(aMessage: TROMessage)
Parameters:
- aMessage:
DispatcherByName
Returns the dispatcher with the given name or NIL. The search is not case-sensitive.
function DispatcherByName(const aName: string): TROMessageDispatcher
Parameters:
- aName: Dispathcher name to look up
FindDispatcher
Returns the dispatcher which CanHandleMessage for the given transport
and stream
.
function FindDispatcher(const aTransport: IROTransport; aRequestStream: TStream): TROMessageDispatcher
Parameters:
- aTransport:
- aRequestStream:
FindDuplicate
Finds the dispatcher with the given message
.
function FindDuplicate(aMessage: TROMessage): TROMessageDispatcher
Parameters:
- aMessage:
GetDispatcherClass protected virtual
Returns TROMessageDispatcher by default.
The TROHTTPMessageDispatchers overrides it to return TROHTTPDispatcher.
function GetDispatcherClass: TROMessageDispatcherClass
GetSupportsMultipleDispatchers protected virtual
Indicates whether multiple dispatchers can be supported by the channel (multiple dispatchers are not supported by the majority of channels, HTTP ones are the exception). Returns false by default.
function GetSupportsMultipleDispatchers: Boolean