Platoo ISAPI ComponentsTISAPIApp

Contents - Events - Methods - Properties

ISAPI DLL application incapsulation


Description
TISAPIApp component is not visible at design time.

At runtime, TISAPIApp is available through global variable ISAPIApp .

Purpose of TISAPIApp is to manage incoming requests (threads): create and initialize request handling objects (dispatchers), cache control, logging, etc.

For every incoming request, TISAPIApp creates a new pre-registered dispatcher-module.


TISAPIApp - Events

Contents - TISAPIApp - Properties - Methods

OnTerminateExtension
TerminateExtension event, may (depends on the server) be called before terminating (unloading) DLL.

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

Description
Event value is taken from the dispatcher.


TISAPIApp - Methods

Contents - TISAPIApp - Properties - Events

~TISAPIApp
Destructor

C++ declaration
__fastcall virtual ~TISAPIApp(void)

Description
Normally you should not need to destroy TISAPIApp object, it will be done at shutdown.

ActivateDispatchModule
Delphi declaration
function ActivateDispatchModule: TDataModule;
C++ declaration
Forms::TDataModule *__fastcall ActivateDispatchModule(void)
ActivateModuleDispatcher
Delphi declaration
function ActivateModuleDispatcher(DataModule: TDataModule): TISAPIDispatcher;
C++ declaration
TISAPIDispatcher *__fastcall ActivateModuleDispatcher(Forms::TDataModule *DataModule)
Create
Constructor

Delphi declaration
constructor Create(AOwner: TComponent);

Description
Normally you should not create TSAPIApp object, it will be created automatically at startup.

DeactivateDispatchModule
Delphi declaration
procedure DeactivateDispatchModule(DataModule: TDataModule);
C++ declaration
void __fastcall DeactivateDispatchModule(Forms::TDataModule *DataModule)
Destroy
Destructor

Delphi declaration
destructor Destroy;

Description
Normally you should not need to destroy TISAPIApp object, it will be done at shutdown.

GetActiveRequests
Delphi declaration
function GetActiveRequests: Integer;
C++ declaration
int __fastcall GetActiveRequests(void)
GetConfigParam
Delphi declaration
function GetConfigParam(SectionName, ItemName: AnsiString): AnsiString;
C++ declaration
System::AnsiString __fastcall GetConfigParam(System::AnsiString SectionName, System::AnsiString ItemName)
GetExtensionVersion
Delphi declaration
function GetExtensionVersion(pVer: PHSE_VERSION_INFO): Boolean;
C++ declaration
bool __fastcall GetExtensionVersion(Isapi::PHSE_VERSION_INFO pVer)

Description
Called by the server.
GetInactiveRequests
Delphi declaration
function GetInactiveRequests: Integer;
C++ declaration
int __fastcall GetInactiveRequests(void)
GetStatusString
HTTP status string from statuscode

Delphi declaration
function GetStatusString(StatusCode: Integer): AnsiString;
C++ declaration
System::AnsiString __fastcall GetStatusString(int StatusCode)

Description
For example: 200: 'OK', ..., 400: 'Bad Request',....

Used internally to generate HTTP response header.

HandleRequest
Delphi declaration
function HandleRequest(Request: TFRISAPIRequest; Response: TFRISAPIResponse): Boolean;
C++ declaration
bool __fastcall HandleRequest(TFRISAPIRequest *Request, TFRISAPIResponse *Response)
HttpExtensionProc
Start point for request handling

Delphi declaration
function HttpExtensionProc(pECB: PEXTENSION_CONTROL_BLOCK): DWORD;
C++ declaration
int __fastcall HttpExtensionProc(Isapi::PEXTENSION_CONTROL_BLOCK pECB)

Description
Forced by the server's call to exported function HttpExtensionProc

InitWebModule
Registering (data)module class, where the dispatcher resides

Delphi declaration
procedure InitWebModule(clWebMod: TComponentClass);
C++ declaration
void __fastcall InitWebModule(System::TMetaClass *clWebMod)

Description
This function must be called immediately after DLL is loaded.

(librarys initialization code block in Delphi, or DllEntryPoint with Reason parameter value DLL_PROCESS_ATTACH in C++Builder)

LoadConfig
Delphi declaration
function LoadConfig: Boolean;
C++ declaration
bool __fastcall LoadConfig(void)
LoadInternalConfig
Delphi declaration
function LoadInternalConfig: Boolean;
C++ declaration
bool __fastcall LoadInternalConfig(void)
Lock
Locking before a thread-unsafe operation

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

Description
Must always call UnLock to release the lock.

It is safer to use TFRISAPIRequest.Lock !

TerminateExtension
Delphi declaration
function TerminateExtension(dwFlags: DWORD): Boolean;
C++ declaration
bool __fastcall TerminateExtension(int dwFlags)

Description
Called by the server.
TISAPIApp
Constructor

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

Description
Normally you should not create TSAPIApp object, it will be created automatically at startup.

UnLock
Unlocking after a thread-unsafe operation

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

Description
Call this after Lock, if locking isn't needed any more.

It is safer to use TFRISAPIRequest.UnLock !

WriteLog
Write string to logfile

Delphi declaration
function WriteLog(LogString: AnsiString; pECB: PEXTENSION_CONTROL_BLOCK): Boolean;
C++ declaration
bool __fastcall WriteLog(System::AnsiString LogString, Isapi::PEXTENSION_CONTROL_BLOCK pECB)

Description
For debug purposes.

Parameter pECB is optional. If set, request parameters will be added to LogString.

The preferred method is TFRISAPIRequest.WriteLog !

WriteLogEx
Writes exception class name and error text to logfile

Delphi declaration
function WriteLogEx(E: Exception; pECB: PEXTENSION_CONTROL_BLOCK): Boolean;
C++ declaration
bool __fastcall WriteLogEx(Sysutils::Exception *E, Isapi::PEXTENSION_CONTROL_BLOCK pECB)

Description
For debug purposes.

Parameter pECB is optional. If set, request parameters will be added to exception message.

The preferred method is TFRISAPIRequest.WriteLogEx !


TISAPIApp - Properties

Contents - TISAPIApp - Methods - Events

ActiveRequests
Currently active (processed) requests (dispatcher-modules) count

Delphi declaration
property ActiveRequests: Integer read GetActiveRequests;
C++ declaration
__property int ActiveRequests={ read=GetActiveRequests, nodefault }

Description
For statistical purposes.

CacheConnections
Enables internal cache

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

Description
Parameter value is taken from the dispatcher.

If caching is enabled, dispatcher-module will, after current request is handled, be stored into the internal cache instead of destroying it, and will be taken from cache when a new request arrives.

Caching may increase the speed a couple of times, especially if the dispatcher-module contains many components.

ConfigParams
Get configuration parameter value from external configuration file by section name and parameter name

Delphi declaration
property ConfigParams[SectionName, ItemName: AnsiString]: AnsiString read GetConfigParam;
C++ declaration
__property System::AnsiString ConfigParams[System::AnsiString SectionName][System::AnsiString ItemName]={ read=GetConfigParam }

Description
Configuration is loaded at startup from the configuration file that resides in the same directory where DLL and has the same filename, the filename extension must be '.frc'.

The configuration file can contain 1...N parameters, every parameter in a separate row.

Row structure: <SectionName>+'_'+<ItemName>+'='<Parameter value>.

Configuration file can be edited with any text editor (for example Notepad) or with our Configuration file editor for TISAPIApp .

ExtDescription
DLLs short description

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

Description
The parameter value is taken from TISAPIDispatcher .

Used in GetExtensionVersion .

InactiveRequests
Currently cached (inactive) dispatcher-modules count

Delphi declaration
property InactiveRequests: Integer read GetInactiveRequests;
C++ declaration
__property int InactiveRequests={ read=GetInactiveRequests, nodefault }

Description
For statistical purposes.

LoggingEnabled
Enables logging

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

Description
Parameter value is taken from TISAPIDispatcher .

Logs will be added to the logfile that resides in the same directory than DLL and has the same filename, the filename extension is '.log'.

A file will be created, if it doesn't exist.