Platoo ISAPI Components TISAPIDispatcher

Contents - Events - Methods - Properties

FR ISAPI Dispatcher component


Description
Purpose of the dispatcher is to find the appropriate request handler (actionitem) depending on the request parameters. It also manages user sessions and is responsible for handling unhandled requests.

At design time, the dispatcher enables the setting properties for TISAPIApp.

The dispatcher resides in the dispatcher-module (TDataModule).

For every request, TISAPIApp creates a new dispatcher-module object.


TISAPIDispatcher - Events

Contents - TISAPIDispatcher - Properties - Methods

AfterAction
Notify after request handling

Delphi declaration
property AfterAction: TFRSessionEvent read FAfterAction write FAfterAction;
C++ declaration
__property TFRSessionEvent AfterAction={ read=FAfterAction, write=FAfterAction }

Description
This event is called after all request handling events are passed.

BeforeAction
Notify about new request

Delphi declaration
property BeforeAction: TFRSessionEvent read FBeforeAction write FBeforeAction;
C++ declaration
__property TFRSessionEvent BeforeAction={ read=FBeforeAction, write=FBeforeAction }

Description
This event is called before any request handling event.

OnActivateSession
Notify about session activated

Delphi declaration
property OnActivateSession: TFRSessionEvent read FOnActivateSession write FOnActivateSession;
C++ declaration
__property TFRSessionEvent OnActivateSession={ read=FOnActivateSession, write=FOnActivateSession }

Description
Forced when a new or existing session becomes active.

OnCheckSessionID
Checking session ID

Delphi declaration
property OnCheckSessionID: TFRChSessionID read FOnCheckSessionID write FOnCheckSessionID;
C++ declaration
__property TFRChSessionID OnCheckSessionID={ read=FOnCheckSessionID, write=FOnCheckSessionID }

Description
Called:

from the CreateSession method to quarantee a unique session ID,

or from the DispatchRequest method before other events to check that the session ID is valid.

OnCheckUserRights
Checking user rights against the table

Delphi declaration
property OnCheckUserRights: TFRChUserRights read FOnCheckUserRights write FOnCheckUserRights;
C++ declaration
__property TFRChUserRights OnCheckUserRights={ read=FOnCheckUserRights, write=FOnCheckUserRights }

Description
Called inside the CheckUserRights method.

OnCreateSession
Notify after a new session is created

Delphi declaration
property OnCreateSession: TFRSessionEvent read FOnCreateSession write FOnCreateSession;
C++ declaration
__property TFRSessionEvent OnCreateSession={ read=FOnCreateSession, write=FOnCreateSession }

Description
Forced by the CreateSession method, when a new session has successfully been created.

OnDeactivateSession
Notify about current session deactivated

Delphi declaration
property OnDeactivateSession: TFRSessionEvent read FOnDeactivateSession write FOnDeactivateSession;
C++ declaration
__property TFRSessionEvent OnDeactivateSession={ read=FOnDeactivateSession, write=FOnDeactivateSession }

Description
Forced, when a request has successfully been handled, or by the DestroySession method.

OnDefaultRequest
Default request handler

Delphi declaration
property OnDefaultRequest: TOnNewRequestEvent read FOnDefaultRequest write FOnDefaultRequest;
C++ declaration
__property TOnNewRequestEvent OnDefaultRequest={ read=FOnDefaultRequest, write=FOnDefaultRequest }

Description
Called, if the request pathinfo is empty.

OnDestroySession
Notify before current session is destroyed

Delphi declaration
property OnDestroySession: TFRSessionEvent read FOnDestroySession write FOnDestroySession;
C++ declaration
__property TFRSessionEvent OnDestroySession={ read=FOnDestroySession, write=FOnDestroySession }

Description
Forced by the DestroySession method.

OnTerminateExtension
TerminateExtension event holder at design time

Delphi declaration
property OnTerminateExtension: TOnTerminateExtensionEvent read FOnTerminateExtension write FOnTerminateExtension;
C++ declaration
__property TOnTerminateExtensionEvent OnTerminateExtension={ read=FOnTerminateExtension, write=FOnTerminateExtension }

Description
At runtime, this event may be called by TISAPIApp before terminating (unloading) DLL (depends of server).

OnUnExpectedRequest
Unexpected requests handler

Delphi declaration
property OnUnExpectedRequest: TOnNewRequestEvent read FOnUnExpectedRequest write FOnUnExpectedRequest;
C++ declaration
__property TOnNewRequestEvent OnUnExpectedRequest={ read=FOnUnExpectedRequest, write=FOnUnExpectedRequest }

Description
Called, if actionitem for the request path is not found.

OnUnhandledRequest
Unhandled request event

Delphi declaration
property OnUnhandledRequest: TOnNewRequestEvent read FOnUnhandledRequest write FOnUnhandledRequest;
C++ declaration
__property TOnNewRequestEvent OnUnhandledRequest={ read=FOnUnhandledRequest, write=FOnUnhandledRequest }

Description
Called, if the request is not handled by actionitem or by OnUnExpectedRequest or OnDefaultRequest handlers.


TISAPIDispatcher - Methods

Contents - TISAPIDispatcher - Properties - Events

~TISAPIDispatcher
Destructor

C++ declaration
__fastcall virtual ~TISAPIDispatcher(void)

Description
Normally you should not free dispatcher objects yourself, it will be done by TISAPIApp.

ActivateSession
Delphi declaration
procedure ActivateSession;
C++ declaration
void __fastcall ActivateSession(void)
CheckUserRights
Checking current user rights against the table and action

Delphi declaration
function CheckUserRights(Sender: TComponent; Action, TableName: AnsiString): Boolean;
C++ declaration
bool __fastcall CheckUserRights(Classes::TComponent *Sender, System::AnsiString Action, System::AnsiString TableName)

Description
Forces the OnCheckUserRights event for the actual checking.

The result is TRUE, when user rights are ok.

Create
Constructor

Delphi declaration
constructor Create(AOwner: TComponent);

Description
Normally you should not create dispatcher objects, it will be created by TISAPIApp for every request.

CreateSession
Creates a new session

Delphi declaration
procedure CreateSession;
C++ declaration
void __fastcall CreateSession(void)

Description
Must be called manually, when a new session is required.

If a session is already active, it destroys the session by calling DestroySession.

Forces the events: OnCheckSessionID, OnCreateSession, OnActivateSession, and activates the session.

DeactivateSession
Delphi declaration
procedure DeactivateSession;
C++ declaration
void __fastcall DeactivateSession(void)
Destroy
Destructor

Delphi declaration
destructor Destroy;

Description
Normally you should not free dispatcher objects yourself, it will be done by TISAPIApp.

DestroySession
Destroying session

Delphi declaration
procedure DestroySession;
C++ declaration
void __fastcall DestroySession(void)

Description
Must be called manually, when session is required to be destroyed.

Forces the events: OnDeactivateSession, OnDestroySession

DispatchRequest
Internal request dispatching

Delphi declaration
function DispatchRequest(Request: TFRISAPIRequest; Response: TFRISAPIResponse): Boolean;
C++ declaration
bool __fastcall DispatchRequest(TFRISAPIRequest *Request, TFRISAPIResponse *Response)

Description
Called by TISAPIApp

GenerateSessionID
Delphi declaration
function GenerateSessionID: AnsiString;
C++ declaration
System::AnsiString __fastcall GenerateSessionID(void)
GetCacheConnections
Delphi declaration
function GetCacheConnections: Boolean;
C++ declaration
bool __fastcall GetCacheConnections(void)
GetExtDescription
Delphi declaration
function GetExtDescription: AnsiString;
C++ declaration
System::AnsiString __fastcall GetExtDescription(void)
GetLoggingEnabled
Delphi declaration
function GetLoggingEnabled: Boolean;
C++ declaration
bool __fastcall GetLoggingEnabled(void)
GetSessName
Delphi declaration
function GetSessName: AnsiString;
C++ declaration
System::AnsiString __fastcall GetSessName(void)
IsSession
Delphi declaration
function IsSession(ASessionID: AnsiString): Boolean;
C++ declaration
bool __fastcall IsSession(System::AnsiString ASessionID)
SetCacheConnections
Delphi declaration
procedure SetCacheConnections(Value: Boolean);
C++ declaration
void __fastcall SetCacheConnections(bool Value)
SetExtDescription
Delphi declaration
procedure SetExtDescription(Value: AnsiString);
C++ declaration
void __fastcall SetExtDescription(System::AnsiString Value)
SetLoggingEnabled
Delphi declaration
procedure SetLoggingEnabled(Value: Boolean);
C++ declaration
void __fastcall SetLoggingEnabled(bool Value)
TISAPIDispatcher
Constructor

C++ declaration
__fastcall virtual TISAPIDispatcher(Classes::TComponent *AOwner)

Description
Normally you should not create dispatcher objects, it will be created by TISAPIApp for every request.


TISAPIDispatcher - Properties

Contents - TISAPIDispatcher - Methods - Events

AppSessions
Enable sessions managing

Delphi declaration
property AppSessions: Boolean read FAppSessions write FAppSessions;
C++ declaration
__property bool AppSessions={ read=FAppSessions, write=FAppSessions, nodefault }

Description
Set TRUE, if you want to use session-managing.

Sessions are usable for checking the users and user rights.

Internally, the session managing uses HTTP Cookies.

CacheConnections
Enable caching

Delphi declaration
property CacheConnections: Boolean read GetCacheConnections write SetCacheConnections;
C++ declaration
__property bool CacheConnections={ read=GetCacheConnections, write=SetCacheConnections, nodefault }

Description
At runtime, will be used by TISAPIApp.

TISAPIApp caches dispatcher-modules: modules will be put into cache after they have finished request handling and will be re-used (taken from cache), when a new request arrives, instead of creating and destroying them. This may increase the speed.

Warning: don't try to use cache for TForm objects. TForm must be destroyed inside the same thread where it was created!

ExtDescription
DLLs short description

Delphi declaration
property ExtDescription: AnsiString read GetExtDescription write SetExtDescription;
C++ declaration
__property System::AnsiString ExtDescription={ read=GetExtDescription, write=SetExtDescription, nodefault }

Description
At runtime, will be used by TISAPIApp inside the GetExtensionVersion .

LicenceKey
Licence key

Delphi declaration
property LicenceKey: TEKeyProp read FKeyProp write FKeyProp;
C++ declaration
__property Unkeyprop::TEKeyProp *LicenceKey={ read=FKeyProp, write=FKeyProp, nodefault }

Description
Set the licence key at design time.

You don't need to distribute the licence key with your application, it will be compiled into executable.

Unlicensed component adds a small notice at the end of each processed HTML page.

A licence key can be obtained from the component distributors: http://www.platoo.ee

LoggingEnabled
Enable error-logging

Delphi declaration
property LoggingEnabled: Boolean read GetLoggingEnabled write SetLoggingEnabled;
C++ declaration
__property bool LoggingEnabled={ read=GetLoggingEnabled, write=SetLoggingEnabled, nodefault }

Description
When enabled, at runtime, TISAPIApp creates and enables writing to logfile.

Logfile name is the same as the DLL name, the extension is ".log".

TISAPIApp writes unhandled errors (catched exceptions) to logfile.

Additionally, you can write to log by using the functions TFRISAPIRequest.WriteLog , TFRISAPIRequest.WriteLogEx .

Warning: don't overuse it, usually the server creates logs itself. This feature is mainly used for debugging purposes and may decrease speed.

Request
Current request

Delphi declaration
property Request: TFRISAPIRequest read FRequest;
C++ declaration
__property TFRISAPIRequest *Request={ read=FRequest, nodefault }

Description
Created by TISAPIApp

Response
Current response

Delphi declaration
property Response: TFRISAPIResponse read FResponse;
C++ declaration
__property TFRISAPIResponse *Response={ read=FResponse, nodefault }

Description
Created by TISAPIApp

SessionActive
Session activity flag

Delphi declaration
property SessionActive: Boolean read FSessionActive;
C++ declaration
__property bool SessionActive={ read=FSessionActive, nodefault }

Description
Shows that the session is currently active.

SessionID
Current session ID

Delphi declaration
property SessionID: AnsiString read FSessID;
C++ declaration
__property System::AnsiString SessionID={ read=FSessID, nodefault }

Description
Will be generated automatically in the CreateSession procedure .

Empty, if there is no active session ( SessionActive = FALSE).

SessionName
Current session name

Delphi declaration
property SessionName: AnsiString read GetSessName;
C++ declaration
__property System::AnsiString SessionName={ read=GetSessName, nodefault }

Description
SessionName = Dispatcher-component name + SessionID