|
@@ -74,6 +74,7 @@ Type
|
|
{ TCustomWebApplication }
|
|
{ TCustomWebApplication }
|
|
TGetModuleEvent = Procedure (Sender : TObject; ARequest : TRequest;
|
|
TGetModuleEvent = Procedure (Sender : TObject; ARequest : TRequest;
|
|
Var ModuleClass : TCustomHTTPModuleClass) of object;
|
|
Var ModuleClass : TCustomHTTPModuleClass) of object;
|
|
|
|
+ TOnShowRequestException = procedure(AResponse: TResponse; AnException: Exception; var handled: boolean);
|
|
|
|
|
|
TCustomWebApplication = Class(TCustomApplication)
|
|
TCustomWebApplication = Class(TCustomApplication)
|
|
Private
|
|
Private
|
|
@@ -82,6 +83,7 @@ Type
|
|
FEmail: String;
|
|
FEmail: String;
|
|
FModuleVar: String;
|
|
FModuleVar: String;
|
|
FOnGetModule: TGetModuleEvent;
|
|
FOnGetModule: TGetModuleEvent;
|
|
|
|
+ FOnShowRequestException: TOnShowRequestException;
|
|
FRequest : TRequest;
|
|
FRequest : TRequest;
|
|
FHandleGetOnPost : Boolean;
|
|
FHandleGetOnPost : Boolean;
|
|
FRedirectOnError : Boolean;
|
|
FRedirectOnError : Boolean;
|
|
@@ -111,6 +113,7 @@ Type
|
|
Property OnGetModule : TGetModuleEvent Read FOnGetModule Write FOnGetModule;
|
|
Property OnGetModule : TGetModuleEvent Read FOnGetModule Write FOnGetModule;
|
|
Property Email : String Read GetEmail Write FEmail;
|
|
Property Email : String Read GetEmail Write FEmail;
|
|
Property Administrator : String Read GetAdministrator Write FAdministrator;
|
|
Property Administrator : String Read GetAdministrator Write FAdministrator;
|
|
|
|
+ property OnShowRequestException: TOnShowRequestException read FOnShowRequestException write FOnShowRequestException;
|
|
end;
|
|
end;
|
|
|
|
|
|
EFPWebError = Class(Exception);
|
|
EFPWebError = Class(Exception);
|
|
@@ -175,9 +178,16 @@ end;
|
|
procedure TCustomWebApplication.ShowRequestException(R: TResponse; E: Exception);
|
|
procedure TCustomWebApplication.ShowRequestException(R: TResponse; E: Exception);
|
|
Var
|
|
Var
|
|
S : TStrings;
|
|
S : TStrings;
|
|
|
|
+ handled: boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
if R.ContentSent then exit;
|
|
if R.ContentSent then exit;
|
|
|
|
+ if assigned(OnShowRequestException) then
|
|
|
|
+ begin
|
|
|
|
+ handled:=false;
|
|
|
|
+ OnShowRequestException(R,E,Handled);
|
|
|
|
+ if handled then exit;
|
|
|
|
+ end;
|
|
If RedirectOnError and not R.HeadersSent then
|
|
If RedirectOnError and not R.HeadersSent then
|
|
begin
|
|
begin
|
|
R.SendRedirect(format(RedirectOnErrorURL,[HTTPEncode(E.Message)]));
|
|
R.SendRedirect(format(RedirectOnErrorURL,[HTTPEncode(E.Message)]));
|