mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 12:49:33 +02:00
* (Modified) Patch from Sven Barth to add AfterInitModule
git-svn-id: trunk@20494 -
This commit is contained in:
parent
b50bd10818
commit
7ab32986ef
@ -78,12 +78,14 @@ Type
|
||||
Var ModuleClass : TCustomHTTPModuleClass) of object;
|
||||
TOnShowRequestException = procedure(AResponse: TResponse; AnException: Exception; var handled: boolean);
|
||||
TLogEvent = Procedure (EventType: TEventType; const Msg: String) of object;
|
||||
TInitModuleEvent = Procedure (Sender : TObject; Module: TCustomHTTPModule) of object;
|
||||
|
||||
{ TWebHandler }
|
||||
|
||||
TWebHandler = class(TComponent)
|
||||
private
|
||||
FOnIdle: TNotifyEvent;
|
||||
FOnInitModule: TInitModuleEvent;
|
||||
FOnUnknownRequestEncoding: TOnUnknownEncodingEvent;
|
||||
FTerminated: boolean;
|
||||
FAdministrator: String;
|
||||
@ -133,6 +135,7 @@ Type
|
||||
property OnIdle: TNotifyEvent read FOnIdle write FOnIdle;
|
||||
Property OnLog : TLogEvent Read FOnLog Write FOnLog;
|
||||
Property OnUnknownRequestEncoding : TOnUnknownEncodingEvent Read FOnUnknownRequestEncoding Write FOnUnknownRequestEncoding;
|
||||
Property OnInitModule: TInitModuleEvent Read FOnInitModule write FOnInitModule;
|
||||
end;
|
||||
|
||||
TCustomWebApplication = Class(TCustomApplication)
|
||||
@ -343,6 +346,9 @@ begin
|
||||
else
|
||||
M:=MC.Create(Self);
|
||||
SetBaseURL(M,MN,ARequest);
|
||||
if (OnInitModule<>Nil) then
|
||||
OnInitModule(Self,M);
|
||||
M.DoAfterInitModule(ARequest);
|
||||
if M.Kind=wkOneShot then
|
||||
begin
|
||||
try
|
||||
|
@ -104,14 +104,18 @@ Type
|
||||
|
||||
{ TCustomHTTPModule }
|
||||
|
||||
TInitModuleEvent = Procedure (Sender : TObject; ARequest : TRequest) of object;
|
||||
TCustomHTTPModule = Class(TDataModule)
|
||||
private
|
||||
FAfterInitModule : TInitModuleEvent;
|
||||
FBaseURL: String;
|
||||
FWebModuleKind: TWebModuleKind;
|
||||
public
|
||||
Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); virtual; abstract;
|
||||
Procedure DoAfterInitModule(ARequest : TRequest); virtual;
|
||||
property Kind: TWebModuleKind read FWebModuleKind write FWebModuleKind default wkPooled;
|
||||
Property BaseURL : String Read FBaseURL Write FBaseURL;
|
||||
Property AfterInitModule : TInitModuleEvent Read FAfterInitModule Write FAfterInitModule;
|
||||
end;
|
||||
TCustomHTTPModuleClass = Class of TCustomHTTPModule;
|
||||
|
||||
@ -244,6 +248,14 @@ begin
|
||||
Result:=GSM;
|
||||
end;
|
||||
|
||||
{ TCustomHTTPModule }
|
||||
|
||||
procedure TCustomHTTPModule.DoAfterInitModule(ARequest: TRequest);
|
||||
begin
|
||||
If Assigned(FAfterInitModule) then
|
||||
FAfterInitModule(Self, ARequest);
|
||||
end;
|
||||
|
||||
{ TSessionFactory }
|
||||
|
||||
function TSessionFactory.CreateSession(ARequest: TRequest): TCustomSession;
|
||||
|
@ -150,6 +150,7 @@ Type
|
||||
property Kind;
|
||||
Property OnNewSession;
|
||||
Property OnSessionExpired;
|
||||
Property AfterInitModule;
|
||||
end;
|
||||
|
||||
EFPWebError = Class(HTTPError);
|
||||
|
Loading…
Reference in New Issue
Block a user