mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
This commit is contained in:
parent
9ab595937b
commit
dff01d4dd2
2
samples/eluaserversideviews/www/index.elua
Normal file
2
samples/eluaserversideviews/www/index.elua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
This is an eLua file
|
||||||
|
<?lua="Hello World" ?>
|
9
samples/eluaserversideviews/www/index.html
Normal file
9
samples/eluaserversideviews/www/index.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<form name="myform" action="/customers" method="POST">
|
||||||
|
FirstName: <input name="first_name"><br>
|
||||||
|
LastName: <input name="last_name"><br>
|
||||||
|
<input type="submit">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
47
samples/renders/BusinessObjectsU.pas
Normal file
47
samples/renders/BusinessObjectsU.pas
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
unit BusinessObjectsU;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
type
|
||||||
|
TPerson = class
|
||||||
|
private
|
||||||
|
FLastName: String;
|
||||||
|
FDOB: TDate;
|
||||||
|
FFirstName: String;
|
||||||
|
FMarried: boolean;
|
||||||
|
procedure SetDOB(const Value: TDate);
|
||||||
|
procedure SetFirstName(const Value: String);
|
||||||
|
procedure SetLastName(const Value: String);
|
||||||
|
procedure SetMarried(const Value: boolean);
|
||||||
|
public
|
||||||
|
property FirstName: String read FFirstName write SetFirstName;
|
||||||
|
property LastName: String read FLastName write SetLastName;
|
||||||
|
property DOB: TDate read FDOB write SetDOB;
|
||||||
|
property Married: boolean read FMarried write SetMarried;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ TPerson }
|
||||||
|
|
||||||
|
procedure TPerson.SetDOB(const Value: TDate);
|
||||||
|
begin
|
||||||
|
FDOB := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPerson.SetFirstName(const Value: String);
|
||||||
|
begin
|
||||||
|
FFirstName := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPerson.SetLastName(const Value: String);
|
||||||
|
begin
|
||||||
|
FLastName := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPerson.SetMarried(const Value: boolean);
|
||||||
|
begin
|
||||||
|
FMarried := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
50
samples/renders/RenderSampleControllerU.pas
Normal file
50
samples/renders/RenderSampleControllerU.pas
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
unit RenderSampleControllerU;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
MVCFramework, MVCFramework.Commons, ObjectsMappers;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
[MVCPath('/')]
|
||||||
|
TRenderSampleController = class(TMVCController)
|
||||||
|
public
|
||||||
|
[MVCHTTPMethod([httpGet])]
|
||||||
|
[MVCPath('/customers')]
|
||||||
|
[MVCProduces('application/json')]
|
||||||
|
procedure GetCustomers(CTX: TWebContext);
|
||||||
|
|
||||||
|
[MVCHTTPMethod([httpGet])]
|
||||||
|
[MVCPath('/customers')]
|
||||||
|
[MVCProduces('text/xml')]
|
||||||
|
procedure GetCustomersXML(CTX: TWebContext);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.SysUtils, BusinessObjectsU, Data.DBXJSON, WebModuleU;
|
||||||
|
|
||||||
|
{ TRoutingSampleController }
|
||||||
|
|
||||||
|
procedure TRenderSampleController.GetCustomers(CTX: TWebContext);
|
||||||
|
var
|
||||||
|
wm: TWebModule1;
|
||||||
|
begin
|
||||||
|
wm := GetCurrentWebModule as TWebModule1;
|
||||||
|
wm.qryCustomers.Open;
|
||||||
|
Render(wm.qryCustomers);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRenderSampleController.GetCustomersXML(CTX: TWebContext);
|
||||||
|
var
|
||||||
|
wm: TWebModule1;
|
||||||
|
begin
|
||||||
|
wm := GetCurrentWebModule as TWebModule1;
|
||||||
|
wm.qryCustomers.Open;
|
||||||
|
Render(wm.qryCustomers);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
32
samples/renders/WebModuleU.dfm
Normal file
32
samples/renders/WebModuleU.dfm
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
object WebModule1: TWebModule1
|
||||||
|
OldCreateOrder = False
|
||||||
|
OnCreate = WebModuleCreate
|
||||||
|
Actions = <>
|
||||||
|
Height = 344
|
||||||
|
Width = 435
|
||||||
|
object FDConnection1: TFDConnection
|
||||||
|
Params.Strings = (
|
||||||
|
|
||||||
|
'Database=C:\Users\Public\Documents\RAD Studio\12.0\Samples\Data\' +
|
||||||
|
'EMPLOYEE.GDB'
|
||||||
|
'User_Name=sysdba'
|
||||||
|
'Password=masterkey'
|
||||||
|
'DriverID=IB')
|
||||||
|
ConnectedStoredUsage = [auDesignTime]
|
||||||
|
Connected = True
|
||||||
|
LoginPrompt = False
|
||||||
|
Left = 160
|
||||||
|
Top = 40
|
||||||
|
end
|
||||||
|
object qryCustomers: TFDQuery
|
||||||
|
Connection = FDConnection1
|
||||||
|
SQL.Strings = (
|
||||||
|
'select * from customer')
|
||||||
|
Left = 160
|
||||||
|
Top = 112
|
||||||
|
end
|
||||||
|
object FDPhysIBDriverLink1: TFDPhysIBDriverLink
|
||||||
|
Left = 160
|
||||||
|
Top = 176
|
||||||
|
end
|
||||||
|
end
|
40
samples/renders/WebModuleU.pas
Normal file
40
samples/renders/WebModuleU.pas
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
unit WebModuleU;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.SysUtils, System.Classes,
|
||||||
|
Web.HTTPApp, MVCFramework, FireDAC.Stan.Intf, FireDAC.Stan.Option,
|
||||||
|
FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
|
||||||
|
FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Stan.Param,
|
||||||
|
FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, Data.DB, FireDAC.Comp.DataSet,
|
||||||
|
FireDAC.Comp.Client, FireDAC.Phys.IBBase, FireDAC.Phys.IB;
|
||||||
|
|
||||||
|
type
|
||||||
|
TWebModule1 = class(TWebModule)
|
||||||
|
FDConnection1: TFDConnection;
|
||||||
|
qryCustomers: TFDQuery;
|
||||||
|
FDPhysIBDriverLink1: TFDPhysIBDriverLink;
|
||||||
|
procedure WebModuleCreate(Sender: TObject);
|
||||||
|
private
|
||||||
|
DMVC: TMVCEngine;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
WebModuleClass: TComponentClass = TWebModule1;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
|
||||||
|
{$R *.dfm}
|
||||||
|
|
||||||
|
|
||||||
|
uses RenderSampleControllerU;
|
||||||
|
|
||||||
|
procedure TWebModule1.WebModuleCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
DMVC := TMVCEngine.Create(self);
|
||||||
|
DMVC.AddController(TRenderSampleController);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
BIN
samples/renders/Win32/Debug/lua5.1.dll
Normal file
BIN
samples/renders/Win32/Debug/lua5.1.dll
Normal file
Binary file not shown.
55
samples/renders/renders.dpr
Normal file
55
samples/renders/renders.dpr
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
program renders;
|
||||||
|
{$APPTYPE CONSOLE}
|
||||||
|
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.SysUtils,
|
||||||
|
Winapi.Windows,
|
||||||
|
IdHTTPWebBrokerBridge,
|
||||||
|
Web.WebReq,
|
||||||
|
Web.WebBroker,
|
||||||
|
WebModuleU in 'WebModuleU.pas' {WebModule1: TWebModule} ,
|
||||||
|
RenderSampleControllerU in 'RenderSampleControllerU.pas',
|
||||||
|
BusinessObjectsU in 'BusinessObjectsU.pas';
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
|
||||||
|
procedure RunServer(APort: Integer);
|
||||||
|
var
|
||||||
|
LInputRecord: TInputRecord;
|
||||||
|
LEvent: DWord;
|
||||||
|
LHandle: THandle;
|
||||||
|
LServer: TIdHTTPWebBrokerBridge;
|
||||||
|
begin
|
||||||
|
Writeln(Format('Starting HTTP Server or port %d', [APort]));
|
||||||
|
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
||||||
|
try
|
||||||
|
LServer.DefaultPort := APort;
|
||||||
|
LServer.Active := True;
|
||||||
|
Writeln('Press ESC to stop the server');
|
||||||
|
LHandle := GetStdHandle(STD_INPUT_HANDLE);
|
||||||
|
while True do
|
||||||
|
begin
|
||||||
|
Win32Check(ReadConsoleInput(LHandle, LInputRecord, 1, LEvent));
|
||||||
|
if (LInputRecord.EventType = KEY_EVENT) and
|
||||||
|
LInputRecord.Event.KeyEvent.bKeyDown and
|
||||||
|
(LInputRecord.Event.KeyEvent.wVirtualKeyCode = VK_ESCAPE) then
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
LServer.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
if WebRequestHandler <> nil then
|
||||||
|
WebRequestHandler.WebModuleClass := WebModuleClass;
|
||||||
|
RunServer(8080);
|
||||||
|
except
|
||||||
|
on E: Exception do
|
||||||
|
Writeln(E.ClassName, ': ', E.Message);
|
||||||
|
end
|
||||||
|
|
||||||
|
end.
|
181
samples/renders/renders.dproj
Normal file
181
samples/renders/renders.dproj
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectGuid>{7CFFAFB8-6EAB-4C80-A815-9942D203CD97}</ProjectGuid>
|
||||||
|
<ProjectVersion>15.2</ProjectVersion>
|
||||||
|
<FrameworkType>VCL</FrameworkType>
|
||||||
|
<MainSource>renders.dpr</MainSource>
|
||||||
|
<Base>True</Base>
|
||||||
|
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||||
|
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||||
|
<TargetedPlatforms>1</TargetedPlatforms>
|
||||||
|
<AppType>Console</AppType>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||||
|
<Base_Win32>true</Base_Win32>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
|
||||||
|
<Base_Win64>true</Base_Win64>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
|
||||||
|
<Cfg_1>true</Cfg_1>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
|
||||||
|
<Cfg_1_Win32>true</Cfg_1_Win32>
|
||||||
|
<CfgParent>Cfg_1</CfgParent>
|
||||||
|
<Cfg_1>true</Cfg_1>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||||
|
<Cfg_2>true</Cfg_2>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base)'!=''">
|
||||||
|
<Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
|
||||||
|
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
|
||||||
|
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
|
||||||
|
<DCC_E>false</DCC_E>
|
||||||
|
<DCC_N>false</DCC_N>
|
||||||
|
<DCC_S>false</DCC_S>
|
||||||
|
<DCC_F>false</DCC_F>
|
||||||
|
<DCC_K>false</DCC_K>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||||
|
<Manifest_File>None</Manifest_File>
|
||||||
|
<DCC_UnitSearchPath>..\..\sources;..\..\lib\iocpdelphiframework;..\..\lib\delphistompclient;..\..\lib\luadelphibinding;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<DCC_UsePackage>FireDACSqliteDriver;DBXSqliteDriver;FireDACPgDriver;fmx;IndySystem;TeeDB;frx19;inetdbbde;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DBXSybaseASEDriver;DbxCommonDriver;vclimg;dbxcds;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vcldb;vcldsnap;fmxFireDAC;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;vclribbon;dsnap;IndyIPServer;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;DBXMSSQLDriver;FmxTeeUI;FireDACIBDriver;CodeSiteExpressPkg;FireDACDBXDriver;inetdbxpress;webdsnap;frxe19;FireDACDb2Driver;adortl;frxDB19;FireDACASADriver;bindcompfmx;ADVLikeComponents;vcldbx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;inetdb;Tee;DBXOdbcDriver;vclFireDAC;xmlrtl;svnui;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;vclactnband;bindengine;soaprtl;bindcompdbx;FMXTee;TeeUI;bindcompvcl;vclie;FireDACADSDriver;vcltouch;VclSmp;FireDACMSSQLDriver;FireDAC;VCLRESTComponents;Intraweb;DBXInformixDriver;DataSnapConnectors;FireDACDataSnapDriver;dsnapcon;DBXFirebirdDriver;inet;fmxobj;FireDACMySQLDriver;vclx;svn;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;RESTComponents;bdertl;FireDACMSAccDriver;DataSnapIndy10ServerTransport;dbexpress;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||||
|
<DCC_UsePackage>FireDACSqliteDriver;DBXSqliteDriver;FireDACPgDriver;fmx;IndySystem;TeeDB;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DBXSybaseASEDriver;DbxCommonDriver;vclimg;dbxcds;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vcldb;vcldsnap;fmxFireDAC;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;vclribbon;dsnap;IndyIPServer;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;DBXMSSQLDriver;FmxTeeUI;FireDACIBDriver;FireDACDBXDriver;inetdbxpress;webdsnap;FireDACDb2Driver;adortl;FireDACASADriver;bindcompfmx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;inetdb;Tee;DBXOdbcDriver;vclFireDAC;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;vclactnband;bindengine;soaprtl;bindcompdbx;FMXTee;TeeUI;bindcompvcl;vclie;FireDACADSDriver;vcltouch;VclSmp;FireDACMSSQLDriver;FireDAC;VCLRESTComponents;Intraweb;DBXInformixDriver;DataSnapConnectors;FireDACDataSnapDriver;dsnapcon;DBXFirebirdDriver;inet;fmxobj;FireDACMySQLDriver;vclx;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;RESTComponents;FireDACMSAccDriver;DataSnapIndy10ServerTransport;dbexpress;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||||
|
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||||
|
<DCC_DebugDCUs>true</DCC_DebugDCUs>
|
||||||
|
<DCC_Optimize>false</DCC_Optimize>
|
||||||
|
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||||
|
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||||
|
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||||
|
<Manifest_File>None</Manifest_File>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||||
|
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||||
|
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||||
|
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||||
|
<DCC_DebugInformation>0</DCC_DebugInformation>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
<MainSource>MainSource</MainSource>
|
||||||
|
</DelphiCompile>
|
||||||
|
<DCCReference Include="WebModuleU.pas">
|
||||||
|
<Form>WebModule1</Form>
|
||||||
|
<FormType>dfm</FormType>
|
||||||
|
<DesignClass>TWebModule</DesignClass>
|
||||||
|
</DCCReference>
|
||||||
|
<DCCReference Include="RenderSampleControllerU.pas"/>
|
||||||
|
<DCCReference Include="BusinessObjectsU.pas"/>
|
||||||
|
<BuildConfiguration Include="Release">
|
||||||
|
<Key>Cfg_2</Key>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
</BuildConfiguration>
|
||||||
|
<BuildConfiguration Include="Base">
|
||||||
|
<Key>Base</Key>
|
||||||
|
</BuildConfiguration>
|
||||||
|
<BuildConfiguration Include="Debug">
|
||||||
|
<Key>Cfg_1</Key>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
</BuildConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<ProjectExtensions>
|
||||||
|
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||||
|
<Borland.ProjectType/>
|
||||||
|
<BorlandProject>
|
||||||
|
<Delphi.Personality>
|
||||||
|
<Source>
|
||||||
|
<Source Name="MainSource">renders.dpr</Source>
|
||||||
|
</Source>
|
||||||
|
<VersionInfo>
|
||||||
|
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||||
|
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||||
|
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||||
|
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||||
|
<VersionInfo Name="Release">0</VersionInfo>
|
||||||
|
<VersionInfo Name="Build">0</VersionInfo>
|
||||||
|
<VersionInfo Name="Debug">False</VersionInfo>
|
||||||
|
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||||
|
<VersionInfo Name="Special">False</VersionInfo>
|
||||||
|
<VersionInfo Name="Private">False</VersionInfo>
|
||||||
|
<VersionInfo Name="DLL">False</VersionInfo>
|
||||||
|
<VersionInfo Name="Locale">1040</VersionInfo>
|
||||||
|
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||||
|
</VersionInfo>
|
||||||
|
<VersionInfoKeys>
|
||||||
|
<VersionInfoKeys Name="CompanyName"/>
|
||||||
|
<VersionInfoKeys Name="FileDescription"/>
|
||||||
|
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||||
|
<VersionInfoKeys Name="InternalName"/>
|
||||||
|
<VersionInfoKeys Name="LegalCopyright"/>
|
||||||
|
<VersionInfoKeys Name="LegalTrademarks"/>
|
||||||
|
<VersionInfoKeys Name="OriginalFilename"/>
|
||||||
|
<VersionInfoKeys Name="ProductName"/>
|
||||||
|
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||||
|
<VersionInfoKeys Name="Comments"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleName"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleDisplayName"/>
|
||||||
|
<VersionInfoKeys Name="UIDeviceFamily"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleIdentifier"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleVersion"/>
|
||||||
|
<VersionInfoKeys Name="CFBundlePackageType"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleSignature"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
|
||||||
|
<VersionInfoKeys Name="UISupportedInterfaceOrientations"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleExecutable"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleResourceSpecification"/>
|
||||||
|
<VersionInfoKeys Name="LSRequiresIPhoneOS"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleInfoDictionaryVersion"/>
|
||||||
|
<VersionInfoKeys Name="CFBundleDevelopmentRegion"/>
|
||||||
|
<VersionInfoKeys Name="package"/>
|
||||||
|
<VersionInfoKeys Name="label"/>
|
||||||
|
<VersionInfoKeys Name="versionCode"/>
|
||||||
|
<VersionInfoKeys Name="versionName"/>
|
||||||
|
<VersionInfoKeys Name="persistent"/>
|
||||||
|
<VersionInfoKeys Name="restoreAnyVersion"/>
|
||||||
|
<VersionInfoKeys Name="installLocation"/>
|
||||||
|
<VersionInfoKeys Name="largeHeap"/>
|
||||||
|
<VersionInfoKeys Name="theme"/>
|
||||||
|
</VersionInfoKeys>
|
||||||
|
<Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="$(BDSBIN)\bcboffice2k190.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="$(BDSBIN)\bcbofficexp190.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k190.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="$(BDSBIN)\dclofficexp190.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
|
</Excluded_Packages>
|
||||||
|
</Delphi.Personality>
|
||||||
|
<Deployment/>
|
||||||
|
<Platforms>
|
||||||
|
<Platform value="Win32">True</Platform>
|
||||||
|
<Platform value="Win64">False</Platform>
|
||||||
|
</Platforms>
|
||||||
|
</BorlandProject>
|
||||||
|
<ProjectFileVersion>12</ProjectFileVersion>
|
||||||
|
</ProjectExtensions>
|
||||||
|
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
|
||||||
|
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
|
||||||
|
</Project>
|
47
samples/routingsample/BusinessObjectsU.pas
Normal file
47
samples/routingsample/BusinessObjectsU.pas
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
unit BusinessObjectsU;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
type
|
||||||
|
TPerson = class
|
||||||
|
private
|
||||||
|
FLastName: String;
|
||||||
|
FDOB: TDate;
|
||||||
|
FFirstName: String;
|
||||||
|
FMarried: boolean;
|
||||||
|
procedure SetDOB(const Value: TDate);
|
||||||
|
procedure SetFirstName(const Value: String);
|
||||||
|
procedure SetLastName(const Value: String);
|
||||||
|
procedure SetMarried(const Value: boolean);
|
||||||
|
public
|
||||||
|
property FirstName: String read FFirstName write SetFirstName;
|
||||||
|
property LastName: String read FLastName write SetLastName;
|
||||||
|
property DOB: TDate read FDOB write SetDOB;
|
||||||
|
property Married: boolean read FMarried write SetMarried;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ TPerson }
|
||||||
|
|
||||||
|
procedure TPerson.SetDOB(const Value: TDate);
|
||||||
|
begin
|
||||||
|
FDOB := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPerson.SetFirstName(const Value: String);
|
||||||
|
begin
|
||||||
|
FFirstName := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPerson.SetLastName(const Value: String);
|
||||||
|
begin
|
||||||
|
FLastName := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPerson.SetMarried(const Value: boolean);
|
||||||
|
begin
|
||||||
|
FMarried := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -3,7 +3,7 @@ unit RoutingSampleControllerU;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
MVCFramework, MVCFramework.Commons;
|
MVCFramework, MVCFramework.Commons, ObjectsMappers;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -11,30 +11,76 @@ type
|
|||||||
TRoutingSampleController = class(TMVCController)
|
TRoutingSampleController = class(TMVCController)
|
||||||
public
|
public
|
||||||
[MVCHTTPMethod([httpGet])]
|
[MVCHTTPMethod([httpGet])]
|
||||||
[MVCPath('/($searchtext)/($page)')]
|
[MVCPath('/search/($searchtext)/($page)')]
|
||||||
[MVCProduce('text/plain')]
|
[MVCProduces('text/plain')]
|
||||||
procedure SearchCustomers(CTX: TWebContext);
|
procedure SearchCustomers(CTX: TWebContext);
|
||||||
|
|
||||||
|
[MVCHTTPMethod([httpGet])]
|
||||||
|
[MVCPath('/people/($id)')]
|
||||||
|
[MVCProduces('application/json')]
|
||||||
|
procedure GetPerson(CTX: TWebContext);
|
||||||
|
|
||||||
|
[MVCHTTPMethod([httpGet])]
|
||||||
|
[MVCPath('/people/($id)/json')]
|
||||||
|
[MVCProduces('application/json')]
|
||||||
|
procedure GetPersonJSON(CTX: TWebContext);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
System.SysUtils;
|
System.SysUtils, BusinessObjectsU, Data.DBXJSON;
|
||||||
|
|
||||||
{ TRoutingSampleController }
|
{ TRoutingSampleController }
|
||||||
|
|
||||||
|
procedure TRoutingSampleController.GetPerson(CTX: TWebContext);
|
||||||
|
var
|
||||||
|
P: TPerson;
|
||||||
|
IDPerson: Integer;
|
||||||
|
begin
|
||||||
|
IDPerson := CTX.Request.ParamsAsInteger['id'];
|
||||||
|
{
|
||||||
|
Use IDPerson to load the person from a database...
|
||||||
|
In this example, we're creating a fake person
|
||||||
|
}
|
||||||
|
P := TPerson.Create;
|
||||||
|
P.FirstName := 'Daniele';
|
||||||
|
P.LastName := 'Teti';
|
||||||
|
P.DOB := EncodeDate(1975, 5, 2);
|
||||||
|
P.Married := True;
|
||||||
|
Render(P);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRoutingSampleController.GetPersonJSON(CTX: TWebContext);
|
||||||
|
var
|
||||||
|
P: TJSONObject;
|
||||||
|
IDPerson: Integer;
|
||||||
|
begin
|
||||||
|
IDPerson := CTX.Request.ParamsAsInteger['id'];
|
||||||
|
{
|
||||||
|
Use IDPerson to load the person from a database...
|
||||||
|
In this example, we're creating a fake person
|
||||||
|
}
|
||||||
|
P := TJSONObject.Create;
|
||||||
|
P.AddPair('FirstName', 'Daniele');
|
||||||
|
P.AddPair('LastName', 'Teti');
|
||||||
|
P.AddPair('DOB', ISODateToString(EncodeDate(1975, 5, 2)));
|
||||||
|
P.AddPair('Married', TJSONTrue.Create);
|
||||||
|
Render(P);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRoutingSampleController.SearchCustomers(CTX: TWebContext);
|
procedure TRoutingSampleController.SearchCustomers(CTX: TWebContext);
|
||||||
var
|
var
|
||||||
search: string;
|
search: string;
|
||||||
p: Integer;
|
P: Integer;
|
||||||
orderby: string;
|
orderby: string;
|
||||||
begin
|
begin
|
||||||
search := CTX.Request.Params['searchtext'];
|
search := CTX.Request.Params['searchtext'];
|
||||||
p := CTX.Request.ParamsAsInteger['page'];
|
P := CTX.Request.ParamsAsInteger['page'];
|
||||||
orderby := '';
|
orderby := '';
|
||||||
if CTX.Request.QueryStringParamExists('order') then
|
if CTX.Request.QueryStringParamExists('order') then
|
||||||
orderby := CTX.Request.QueryStringParam('order');
|
orderby := CTX.Request.QueryStringParam('order');
|
||||||
Render(Format('SEARCHTEXT: "%s", PAGE: %d, ORDERBYFIELD: "%s"', [search, p, orderby]));
|
Render(Format('SEARCHTEXT: "%s", PAGE: %d, ORDERBYFIELD: "%s"', [search, P, orderby]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -8,7 +8,8 @@ uses
|
|||||||
Web.WebReq,
|
Web.WebReq,
|
||||||
Web.WebBroker,
|
Web.WebBroker,
|
||||||
WebModuleU in 'WebModuleU.pas' {WebModule1: TWebModule},
|
WebModuleU in 'WebModuleU.pas' {WebModule1: TWebModule},
|
||||||
RoutingSampleControllerU in 'RoutingSampleControllerU.pas';
|
RoutingSampleControllerU in 'RoutingSampleControllerU.pas',
|
||||||
|
BusinessObjectsU in 'BusinessObjectsU.pas';
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@
|
|||||||
<DesignClass>TWebModule</DesignClass>
|
<DesignClass>TWebModule</DesignClass>
|
||||||
</DCCReference>
|
</DCCReference>
|
||||||
<DCCReference Include="RoutingSampleControllerU.pas"/>
|
<DCCReference Include="RoutingSampleControllerU.pas"/>
|
||||||
|
<DCCReference Include="BusinessObjectsU.pas"/>
|
||||||
<BuildConfiguration Include="Release">
|
<BuildConfiguration Include="Release">
|
||||||
<Key>Cfg_2</Key>
|
<Key>Cfg_2</Key>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
|
2
samples/simplewebapplication/www/index.elua
Normal file
2
samples/simplewebapplication/www/index.elua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
This is an eLua file
|
||||||
|
<?lua="Hello World" ?>
|
Loading…
Reference in New Issue
Block a user