2014-05-22 12:48:17 +02:00
|
|
|
unit MainWebModuleUnit;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
2017-03-30 21:22:54 +02:00
|
|
|
uses
|
|
|
|
System.SysUtils,
|
|
|
|
System.Classes,
|
|
|
|
Web.HTTPApp,
|
|
|
|
MVCFramework,
|
|
|
|
MVCFramework.Commons;
|
2014-05-22 12:48:17 +02:00
|
|
|
|
|
|
|
type
|
2017-03-30 21:22:54 +02:00
|
|
|
|
2014-05-22 12:48:17 +02:00
|
|
|
Twm = class(TWebModule)
|
|
|
|
procedure WebModule1DefaultHandlerAction(Sender: TObject;
|
|
|
|
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
|
|
|
|
procedure WebModuleCreate(Sender: TObject);
|
|
|
|
procedure WebModuleDestroy(Sender: TObject);
|
|
|
|
|
|
|
|
private
|
|
|
|
MVCEngine: TMVCEngine;
|
|
|
|
|
|
|
|
public
|
|
|
|
{ Public declarations }
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
WebModuleClass: TComponentClass = Twm;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
|
|
|
WineCellarAppControllerU;
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure Twm.WebModule1DefaultHandlerAction(Sender: TObject;
|
|
|
|
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
|
|
|
|
begin
|
|
|
|
Response.Content :=
|
|
|
|
'<html><heading/><body>Web Server Application</body></html>';
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure Twm.WebModuleCreate(Sender: TObject);
|
|
|
|
begin
|
|
|
|
MVCEngine := TMVCEngine.Create(self);
|
|
|
|
MVCEngine.AddController(TWineCellarApp);
|
2016-10-10 15:48:48 +02:00
|
|
|
MVCEngine.Config[TMVCConfigKey.DocumentRoot] := ''; // static files are not served by dmvc
|
2014-05-22 12:48:17 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure Twm.WebModuleDestroy(Sender: TObject);
|
|
|
|
begin
|
|
|
|
MVCEngine.Free;
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|