mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
ADD ISAPI SAMPLE
Small refactoring
This commit is contained in:
parent
49bbc1e9f9
commit
0f347fc567
47
samples/ISAPI/BO/BusinessObjectsU.pas
Normal file
47
samples/ISAPI/BO/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.
|
77
samples/ISAPI/Controllers/RoutingSampleControllerU.pas
Normal file
77
samples/ISAPI/Controllers/RoutingSampleControllerU.pas
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
unit RoutingSampleControllerU;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
MVCFramework, MVCFramework.Commons, ObjectsMappers;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
[MVCPath('/')]
|
||||||
|
TRoutingSampleController = class(TMVCController)
|
||||||
|
public
|
||||||
|
[MVCPath('/')]
|
||||||
|
procedure Index(CTX: TWebContext);
|
||||||
|
|
||||||
|
[MVCHTTPMethod([httpGet])]
|
||||||
|
[MVCPath('/search/($searchtext)/($page)')]
|
||||||
|
[MVCProduces('text/plain', 'UTF-8')]
|
||||||
|
[MVCConsumes('text/html')]
|
||||||
|
procedure SearchCustomers(CTX: TWebContext);
|
||||||
|
|
||||||
|
[MVCHTTPMethod([httpGet])]
|
||||||
|
[MVCPath('/people/($id)')]
|
||||||
|
[MVCProduces('application/json')]
|
||||||
|
procedure GetPerson(CTX: TWebContext);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.SysUtils, BusinessObjectsU, Data.DBXJSON;
|
||||||
|
|
||||||
|
{ 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.Index(CTX: TWebContext);
|
||||||
|
begin
|
||||||
|
Render('This is the root path');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRoutingSampleController.SearchCustomers(CTX: TWebContext);
|
||||||
|
var
|
||||||
|
search: string;
|
||||||
|
P: Integer;
|
||||||
|
orderby: string;
|
||||||
|
begin
|
||||||
|
search := CTX.Request.Params['searchtext'];
|
||||||
|
P := CTX.Request.ParamsAsInteger['page'];
|
||||||
|
orderby := '';
|
||||||
|
if CTX.Request.QueryStringParamExists('order') then
|
||||||
|
orderby := CTX.Request.QueryStringParam('order');
|
||||||
|
Render(Format(
|
||||||
|
'SEARCHTEXT: "%s"' + sLineBreak +
|
||||||
|
'PAGE: %d' + sLineBreak +
|
||||||
|
'ORDERBYFIELD: "%s"',
|
||||||
|
[search, P, orderby]));
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
25
samples/ISAPI/ISAPI/isapiapp.dpr
Normal file
25
samples/ISAPI/ISAPI/isapiapp.dpr
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
library isapiapp;
|
||||||
|
|
||||||
|
uses
|
||||||
|
Winapi.ActiveX,
|
||||||
|
System.Win.ComObj,
|
||||||
|
Web.WebBroker,
|
||||||
|
Web.Win.ISAPIApp,
|
||||||
|
Web.Win.ISAPIThreadPool,
|
||||||
|
WebModuleU in '..\WebModules\WebModuleU.pas' {WebModule1: TWebModule},
|
||||||
|
BusinessObjectsU in '..\BO\BusinessObjectsU.pas',
|
||||||
|
RoutingSampleControllerU in '..\Controllers\RoutingSampleControllerU.pas';
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
exports
|
||||||
|
GetExtensionVersion,
|
||||||
|
HttpExtensionProc,
|
||||||
|
TerminateExtension;
|
||||||
|
|
||||||
|
begin
|
||||||
|
CoInitFlags := COINIT_MULTITHREADED;
|
||||||
|
Application.Initialize;
|
||||||
|
Application.WebModuleClass := WebModuleClass;
|
||||||
|
Application.Run;
|
||||||
|
end.
|
184
samples/ISAPI/ISAPI/isapiapp.dproj
Normal file
184
samples/ISAPI/ISAPI/isapiapp.dproj
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectGuid>{848C41EB-8EF5-472E-8C10-A70151A657B3}</ProjectGuid>
|
||||||
|
<ProjectVersion>15.3</ProjectVersion>
|
||||||
|
<FrameworkType>VCL</FrameworkType>
|
||||||
|
<MainSource>isapiapp.dpr</MainSource>
|
||||||
|
<Base>True</Base>
|
||||||
|
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||||
|
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||||
|
<TargetedPlatforms>1</TargetedPlatforms>
|
||||||
|
<AppType>Library</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)'!=''">
|
||||||
|
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
<Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
|
||||||
|
<GenDll>true</GenDll>
|
||||||
|
<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)'!=''">
|
||||||
|
<DCC_ExeOutput>..\bin</DCC_ExeOutput>
|
||||||
|
<Manifest_File>None</Manifest_File>
|
||||||
|
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<DCC_UsePackage>FireDACSqliteDriver;TsiLang_XE5r;DBXSqliteDriver;FireDACPgDriver;fmx;TreeViewPresenter;IndySystem;i18n;TeeDB;frx19;vclib;inetdbbde;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DPFAndroidPackagesXE5;DBXSybaseASEDriver;DbxCommonDriver;vclimg;dbxcds;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vcldb;vcldsnap;fmxFireDAC;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;vclribbon;dsnap;IndyIPServer;i18nDB;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;DBXMSSQLDriver;FmxTeeUI;FireDACIBDriver;CodeSiteExpressPkg;DataSnapFireDAC;FireDACDBXDriver;inetdbxpress;FireDACDb2Driver;adortl;CustomAdaptersMDPackage;DataBindingsVCL;FireDACASADriver;bindcompfmx;vcldbx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;inetdb;Tee;DataBindings;DBXOdbcDriver;vclFireDAC;CPortLibDXE;xmlrtl;svnui;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;bindengine;vclactnband;soaprtl;bindcompdbx;FMXTee;TeeUI;bindcompvcl;vclie;FireDACADSDriver;vcltouch;fmxinfopower;VclSmp;FireDACMSSQLDriver;FireDAC;VCLRESTComponents;Intraweb;DBXInformixDriver;DataSnapConnectors;FireDACDataSnapDriver;dsnapcon;DBXFirebirdDriver;inet;fmxobj;FireDACMySQLDriver;vclx;svn;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;RESTComponents;bdertl;VirtualTreesR;FireDACMSAccDriver;DataSnapIndy10ServerTransport;dbexpress;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||||
|
<DCC_UsePackage>FireDACSqliteDriver;DBXSqliteDriver;FireDACPgDriver;fmx;TreeViewPresenter;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;DataSnapFireDAC;FireDACDBXDriver;inetdbxpress;FireDACDb2Driver;adortl;DataBindingsVCL;FireDACASADriver;bindcompfmx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;inetdb;Tee;DataBindings;DBXOdbcDriver;vclFireDAC;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;bindengine;vclactnband;soaprtl;bindcompdbx;FMXTee;TeeUI;bindcompvcl;vclie;FireDACADSDriver;vcltouch;fmxinfopower;VclSmp;FireDACMSSQLDriver;FireDAC;VCLRESTComponents;Intraweb;DBXInformixDriver;DataSnapConnectors;FireDACDataSnapDriver;dsnapcon;DBXFirebirdDriver;inet;fmxobj;FireDACMySQLDriver;vclx;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;RESTComponents;VirtualTreesR;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)'!=''">
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<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="..\WebModules\WebModuleU.pas">
|
||||||
|
<Form>WebModule1</Form>
|
||||||
|
<FormType>dfm</FormType>
|
||||||
|
<DesignClass>TWebModule</DesignClass>
|
||||||
|
</DCCReference>
|
||||||
|
<DCCReference Include="..\BO\BusinessObjectsU.pas"/>
|
||||||
|
<DCCReference Include="..\Controllers\RoutingSampleControllerU.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>
|
||||||
|
<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>
|
||||||
|
<Source>
|
||||||
|
<Source Name="MainSource">isapiapp.dpr</Source>
|
||||||
|
</Source>
|
||||||
|
<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>
|
48
samples/ISAPI/ProjectGroup.groupproj
Normal file
48
samples/ISAPI/ProjectGroup.groupproj
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectGuid>{C8F2ABF8-B8A8-4590-B169-A43EAFA5A161}</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Projects Include="StandAlone\StandAloneServer.dproj">
|
||||||
|
<Dependencies/>
|
||||||
|
</Projects>
|
||||||
|
<Projects Include="ISAPI\isapiapp.dproj">
|
||||||
|
<Dependencies/>
|
||||||
|
</Projects>
|
||||||
|
</ItemGroup>
|
||||||
|
<ProjectExtensions>
|
||||||
|
<Borland.Personality>Default.Personality.12</Borland.Personality>
|
||||||
|
<Borland.ProjectType/>
|
||||||
|
<BorlandProject>
|
||||||
|
<Default.Personality/>
|
||||||
|
</BorlandProject>
|
||||||
|
</ProjectExtensions>
|
||||||
|
<Target Name="StandAloneServer">
|
||||||
|
<MSBuild Projects="StandAlone\StandAloneServer.dproj"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="StandAloneServer:Clean">
|
||||||
|
<MSBuild Projects="StandAlone\StandAloneServer.dproj" Targets="Clean"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="StandAloneServer:Make">
|
||||||
|
<MSBuild Projects="StandAlone\StandAloneServer.dproj" Targets="Make"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="isapiapp">
|
||||||
|
<MSBuild Projects="ISAPI\isapiapp.dproj"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="isapiapp:Clean">
|
||||||
|
<MSBuild Projects="ISAPI\isapiapp.dproj" Targets="Clean"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="isapiapp:Make">
|
||||||
|
<MSBuild Projects="ISAPI\isapiapp.dproj" Targets="Make"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="Build">
|
||||||
|
<CallTarget Targets="StandAloneServer;isapiapp"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="Clean">
|
||||||
|
<CallTarget Targets="StandAloneServer:Clean;isapiapp:Clean"/>
|
||||||
|
</Target>
|
||||||
|
<Target Name="Make">
|
||||||
|
<CallTarget Targets="StandAloneServer:Make;isapiapp:Make"/>
|
||||||
|
</Target>
|
||||||
|
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
|
||||||
|
</Project>
|
55
samples/ISAPI/StandAlone/StandAloneServer.dpr
Normal file
55
samples/ISAPI/StandAlone/StandAloneServer.dpr
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
program StandAloneServer;
|
||||||
|
{$APPTYPE CONSOLE}
|
||||||
|
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.SysUtils,
|
||||||
|
Winapi.Windows,
|
||||||
|
IdHTTPWebBrokerBridge,
|
||||||
|
Web.WebReq,
|
||||||
|
Web.WebBroker,
|
||||||
|
WebModuleU in '..\WebModules\WebModuleU.pas' {WebModule1: TWebModule} ,
|
||||||
|
RoutingSampleControllerU in '..\Controllers\RoutingSampleControllerU.pas',
|
||||||
|
BusinessObjectsU in '..\BO\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/ISAPI/StandAlone/StandAloneServer.dproj
Normal file
181
samples/ISAPI/StandAlone/StandAloneServer.dproj
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectGuid>{89FED123-CDD0-460A-9CC6-5810B281BF84}</ProjectGuid>
|
||||||
|
<ProjectVersion>15.3</ProjectVersion>
|
||||||
|
<FrameworkType>VCL</FrameworkType>
|
||||||
|
<MainSource>StandAloneServer.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_ExeOutput>..\bin</DCC_ExeOutput>
|
||||||
|
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<DCC_UsePackage>FireDACSqliteDriver;TsiLang_XE5r;DBXSqliteDriver;FireDACPgDriver;fmx;TreeViewPresenter;IndySystem;i18n;TeeDB;frx19;vclib;inetdbbde;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DPFAndroidPackagesXE5;DBXSybaseASEDriver;DbxCommonDriver;vclimg;dbxcds;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vcldb;vcldsnap;fmxFireDAC;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;vclribbon;dsnap;IndyIPServer;i18nDB;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;DBXMSSQLDriver;FmxTeeUI;FireDACIBDriver;CodeSiteExpressPkg;DataSnapFireDAC;FireDACDBXDriver;inetdbxpress;FireDACDb2Driver;adortl;CustomAdaptersMDPackage;DataBindingsVCL;FireDACASADriver;bindcompfmx;vcldbx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;inetdb;Tee;DataBindings;DBXOdbcDriver;vclFireDAC;CPortLibDXE;xmlrtl;svnui;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;bindengine;vclactnband;soaprtl;bindcompdbx;FMXTee;TeeUI;bindcompvcl;vclie;FireDACADSDriver;vcltouch;fmxinfopower;VclSmp;FireDACMSSQLDriver;FireDAC;VCLRESTComponents;Intraweb;DBXInformixDriver;DataSnapConnectors;FireDACDataSnapDriver;dsnapcon;DBXFirebirdDriver;inet;fmxobj;FireDACMySQLDriver;vclx;svn;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;RESTComponents;bdertl;VirtualTreesR;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>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||||
|
<DCC_UsePackage>FireDACSqliteDriver;DBXSqliteDriver;FireDACPgDriver;fmx;TreeViewPresenter;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;DataSnapFireDAC;FireDACDBXDriver;inetdbxpress;FireDACDb2Driver;adortl;DataBindingsVCL;FireDACASADriver;bindcompfmx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;inetdb;Tee;DataBindings;DBXOdbcDriver;vclFireDAC;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;bindengine;vclactnband;soaprtl;bindcompdbx;FMXTee;TeeUI;bindcompvcl;vclie;FireDACADSDriver;vcltouch;fmxinfopower;VclSmp;FireDACMSSQLDriver;FireDAC;VCLRESTComponents;Intraweb;DBXInformixDriver;DataSnapConnectors;FireDACDataSnapDriver;dsnapcon;DBXFirebirdDriver;inet;fmxobj;FireDACMySQLDriver;vclx;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;RESTComponents;VirtualTreesR;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="..\WebModules\WebModuleU.pas">
|
||||||
|
<Form>WebModule1</Form>
|
||||||
|
<FormType>dfm</FormType>
|
||||||
|
<DesignClass>TWebModule</DesignClass>
|
||||||
|
</DCCReference>
|
||||||
|
<DCCReference Include="..\Controllers\RoutingSampleControllerU.pas"/>
|
||||||
|
<DCCReference Include="..\BO\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>
|
||||||
|
<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>
|
||||||
|
<Source>
|
||||||
|
<Source Name="MainSource">StandAloneServer.dpr</Source>
|
||||||
|
</Source>
|
||||||
|
<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>
|
7
samples/ISAPI/WebModules/WebModuleU.dfm
Normal file
7
samples/ISAPI/WebModules/WebModuleU.dfm
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
object WebModule1: TWebModule1
|
||||||
|
OldCreateOrder = False
|
||||||
|
OnCreate = WebModuleCreate
|
||||||
|
Actions = <>
|
||||||
|
Height = 230
|
||||||
|
Width = 415
|
||||||
|
end
|
35
samples/ISAPI/WebModules/WebModuleU.pas
Normal file
35
samples/ISAPI/WebModules/WebModuleU.pas
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
unit WebModuleU;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
System.SysUtils, System.Classes,
|
||||||
|
Web.HTTPApp, MVCFramework;
|
||||||
|
|
||||||
|
type
|
||||||
|
TWebModule1 = class(TWebModule)
|
||||||
|
procedure WebModuleCreate(Sender: TObject);
|
||||||
|
private
|
||||||
|
DMVC: TMVCEngine;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
WebModuleClass: TComponentClass = TWebModule1;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
|
||||||
|
{$R *.dfm}
|
||||||
|
|
||||||
|
|
||||||
|
uses RoutingSampleControllerU;
|
||||||
|
|
||||||
|
procedure TWebModule1.WebModuleCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
DMVC := TMVCEngine.Create(self);
|
||||||
|
DMVC.AddController(TRoutingSampleController);
|
||||||
|
if IsConsole then
|
||||||
|
DMVC.Config['ISAPI_PATH'] := '/sampleisapi/isapiapp.dll';
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
Binary file not shown.
@ -121,7 +121,7 @@ begin
|
|||||||
{ ISAPI CHANGE THE REQUEST PATH INFO START }
|
{ ISAPI CHANGE THE REQUEST PATH INFO START }
|
||||||
if IsLibrary then
|
if IsLibrary then
|
||||||
begin
|
begin
|
||||||
AWebRequestPathInfo := String(AWebRequestPathInfo).Remove(0, FMVCConfig.Value['ISAPI_PATH'].Length);
|
AWebRequestPathInfo := String(AWebRequestPathInfo).Remove(0, FMVCConfig.Value['isapi_path'].Length);
|
||||||
if Length(AWebRequestPathInfo) = 0 then
|
if Length(AWebRequestPathInfo) = 0 then
|
||||||
AWebRequestPathInfo := '/';
|
AWebRequestPathInfo := '/';
|
||||||
end;
|
end;
|
||||||
|
@ -389,10 +389,28 @@ type
|
|||||||
Config: TMVCConfig): boolean;
|
Config: TMVCConfig): boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
type
|
||||||
|
TMVCConfigKey = class
|
||||||
|
public
|
||||||
|
const
|
||||||
|
SessionTimeout = 'sessiontimeout';
|
||||||
|
DocumentRoot = 'document_root';
|
||||||
|
ViewPath = 'view_path';
|
||||||
|
DefaultContentType = 'default_content_type';
|
||||||
|
DefaultViewFileExtension = 'default_view_file_extension';
|
||||||
|
ISAPIPath = 'isapi_path';
|
||||||
|
StompServer = 'stompserver';
|
||||||
|
StompServerPort = 'stompserverport';
|
||||||
|
StompUsername = 'stompusername';
|
||||||
|
StompPassword = 'stomppassword';
|
||||||
|
Messaging = 'messaging';
|
||||||
|
end;
|
||||||
|
|
||||||
function IsShuttingDown: boolean;
|
function IsShuttingDown: boolean;
|
||||||
procedure EnterInShutdownState;
|
procedure EnterInShutdownState;
|
||||||
|
|
||||||
procedure InternalRender(const Content: string; ContentType, ContentEncoding: String; Context: TWebContext); overload;
|
procedure InternalRender(const Content: string; ContentType, ContentEncoding: String;
|
||||||
|
Context: TWebContext); overload;
|
||||||
procedure InternalRender(AJSONValue: TJSONValue; ContentType, ContentEncoding: String; Context: TWebContext;
|
procedure InternalRender(AJSONValue: TJSONValue; ContentType, ContentEncoding: String; Context: TWebContext;
|
||||||
AInstanceOwner: boolean = true); overload;
|
AInstanceOwner: boolean = true); overload;
|
||||||
|
|
||||||
@ -449,17 +467,31 @@ end;
|
|||||||
|
|
||||||
procedure TMVCEngine.ConfigDefaultValues;
|
procedure TMVCEngine.ConfigDefaultValues;
|
||||||
begin
|
begin
|
||||||
Config['sessiontimeout'] := '30'; // 30 minutes
|
Config[TMVCConfigKey.SessionTimeout] := '30'; // 30 minutes
|
||||||
Config['document_root'] := '..\..\..\www';
|
Config[TMVCConfigKey.DocumentRoot] := '..\..\..\www';
|
||||||
Config['view_path'] := 'eLua';
|
Config[TMVCConfigKey.ViewPath] := 'eLua';
|
||||||
Config['default_content_type'] := TMVCMimeType.APPLICATION_JSON;
|
Config[TMVCConfigKey.DefaultContentType] := TMVCMimeType.APPLICATION_JSON;
|
||||||
Config['default_view_file_extension'] := 'elua';
|
Config[TMVCConfigKey.DefaultViewFileExtension] := 'elua';
|
||||||
|
Config[TMVCConfigKey.ISAPIPath] := '';
|
||||||
|
|
||||||
Config['stompserver'] := 'localhost';
|
Config[TMVCConfigKey.StompServer] := 'localhost';
|
||||||
Config['stompserverport'] := '61613';
|
Config[TMVCConfigKey.StompServerPort] := '61613';
|
||||||
Config['stompusername'] := 'guest';
|
Config[TMVCConfigKey.StompUsername] := 'guest';
|
||||||
Config['stomppassword'] := 'guest';
|
Config[TMVCConfigKey.StompPassword] := 'guest';
|
||||||
Config['messaging'] := 'true';
|
Config[TMVCConfigKey.Messaging] := 'true';
|
||||||
|
|
||||||
|
// Config['sessiontimeout'] := '30'; // 30 minutes
|
||||||
|
// Config['document_root'] := '..\..\..\www';
|
||||||
|
// Config['view_path'] := 'eLua';
|
||||||
|
// Config['default_content_type'] := TMVCMimeType.APPLICATION_JSON;
|
||||||
|
// Config['default_view_file_extension'] := 'elua';
|
||||||
|
// Config['isapi_path'] := '';
|
||||||
|
//
|
||||||
|
// Config['stompserver'] := 'localhost';
|
||||||
|
// Config['stompserverport'] := '61613';
|
||||||
|
// Config['stompusername'] := 'guest';
|
||||||
|
// Config['stomppassword'] := 'guest';
|
||||||
|
// Config['messaging'] := 'true';
|
||||||
/// ///////
|
/// ///////
|
||||||
FMimeTypes.Add('.html', TMVCMimeType.TEXT_HTML);
|
FMimeTypes.Add('.html', TMVCMimeType.TEXT_HTML);
|
||||||
FMimeTypes.Add('.htm', TMVCMimeType.TEXT_HTML);
|
FMimeTypes.Add('.htm', TMVCMimeType.TEXT_HTML);
|
||||||
@ -518,7 +550,7 @@ begin
|
|||||||
try
|
try
|
||||||
// Static file handling
|
// Static file handling
|
||||||
if TMVCStaticContents.IsStaticFile(TPath.Combine(AppPath,
|
if TMVCStaticContents.IsStaticFile(TPath.Combine(AppPath,
|
||||||
FMVCConfig['document_root']), Request.PathInfo, StaticFileName) then
|
FMVCConfig[TMVCConfigKey.DocumentRoot]), Request.PathInfo, StaticFileName) then
|
||||||
begin
|
begin
|
||||||
if TMVCStaticContents.IsScriptableFile(StaticFileName, FMVCConfig)
|
if TMVCStaticContents.IsScriptableFile(StaticFileName, FMVCConfig)
|
||||||
then
|
then
|
||||||
@ -552,6 +584,9 @@ begin
|
|||||||
Context.SetParams(ParamsTable);
|
Context.SetParams(ParamsTable);
|
||||||
SelectedController.SetContext(Context);
|
SelectedController.SetContext(Context);
|
||||||
SelectedController.SetMVCEngine(Self);
|
SelectedController.SetMVCEngine(Self);
|
||||||
|
Log(TLogLevel.levNormal, Context.Request.HTTPMethodAsString + ':' + Request.RawPathInfo + ' -> ' +
|
||||||
|
Router.MVCControllerClass.QualifiedClassName);
|
||||||
|
|
||||||
// exception?
|
// exception?
|
||||||
try
|
try
|
||||||
SelectedController.MVCControllerAfterCreate;
|
SelectedController.MVCControllerAfterCreate;
|
||||||
@ -668,7 +703,8 @@ begin
|
|||||||
raise Exception.Create('Not implemented');
|
raise Exception.Create('Not implemented');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TMVCEngine.GetCurrentSession(Config: TMVCConfig;
|
class
|
||||||
|
function TMVCEngine.GetCurrentSession(Config: TMVCConfig;
|
||||||
const AWebRequest: TWebRequest; const AWebResponse: TWebResponse;
|
const AWebRequest: TWebRequest; const AWebResponse: TWebResponse;
|
||||||
const BindToThisSessionID: string; ARaiseExceptionIfExpired: boolean)
|
const BindToThisSessionID: string; ARaiseExceptionIfExpired: boolean)
|
||||||
: TWebSession;
|
: TWebSession;
|
||||||
@ -1270,9 +1306,9 @@ end;
|
|||||||
|
|
||||||
function TMVCController.GetNewStompClient(ClientID: string): IStompClient;
|
function TMVCController.GetNewStompClient(ClientID: string): IStompClient;
|
||||||
begin
|
begin
|
||||||
Result := StompUtils.NewStomp(Config['stompserver'],
|
Result := StompUtils.NewStomp(Config[TMVCConfigKey.StompServer],
|
||||||
StrToInt(Config['stompserverport']), GetClientID, Config['stompusername'],
|
StrToInt(Config[TMVCConfigKey.StompServerPort]), GetClientID, Config[TMVCConfigKey.StompUsername],
|
||||||
Config['stomppassword']);
|
Config[TMVCConfigKey.StompPassword]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMVCController.GetWebSession: TWebSession;
|
function TMVCController.GetWebSession: TWebSession;
|
||||||
@ -1338,7 +1374,7 @@ procedure TMVCController.OnBeforeAction(Context: TWebContext;
|
|||||||
begin
|
begin
|
||||||
Handled := false;
|
Handled := false;
|
||||||
if ContentType.IsEmpty then
|
if ContentType.IsEmpty then
|
||||||
ContentType := GetMVCConfig['default_content_type'];
|
ContentType := GetMVCConfig[TMVCConfigKey.DefaultContentType];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMVCController.PushDataSetToView(const AModelName: string;
|
procedure TMVCController.PushDataSetToView(const AModelName: string;
|
||||||
@ -1486,7 +1522,7 @@ begin
|
|||||||
TMonitor.Enter(SessionList);
|
TMonitor.Enter(SessionList);
|
||||||
try
|
try
|
||||||
Sess := TMVCSessionFactory.GetInstance.CreateNewByType('memory',
|
Sess := TMVCSessionFactory.GetInstance.CreateNewByType('memory',
|
||||||
SessionID, StrToInt64(Config['sessiontimeout']));
|
SessionID, StrToInt64(Config[TMVCConfigKey.SessionTimeout]));
|
||||||
SessionList.Add(SessionID, Sess);
|
SessionList.Add(SessionID, Sess);
|
||||||
FWebSession := Sess;
|
FWebSession := Sess;
|
||||||
Sess.MarkAsUsed;
|
Sess.MarkAsUsed;
|
||||||
@ -1720,7 +1756,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ TMVCStaticContents }
|
{ TMVCStaticContents }
|
||||||
class procedure TMVCStaticContents.SendFile(AFileName, AMimeType: string;
|
class
|
||||||
|
procedure TMVCStaticContents.SendFile(AFileName, AMimeType: string;
|
||||||
Context: TWebContext);
|
Context: TWebContext);
|
||||||
var
|
var
|
||||||
LFileDate: TDateTime;
|
LFileDate: TDateTime;
|
||||||
@ -1753,14 +1790,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TMVCStaticContents.IsScriptableFile(StaticFileName: string;
|
class
|
||||||
|
function TMVCStaticContents.IsScriptableFile(StaticFileName: string;
|
||||||
Config: TMVCConfig): boolean;
|
Config: TMVCConfig): boolean;
|
||||||
begin
|
begin
|
||||||
Result := TPath.GetExtension(StaticFileName).ToLower = '.' +
|
Result := TPath.GetExtension(StaticFileName).ToLower = '.' +
|
||||||
Config['default_view_file_extension'].ToLower;
|
Config[TMVCConfigKey.DefaultViewFileExtension].ToLower;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TMVCStaticContents.IsStaticFile(AViewPath, AWebRequestPath
|
class
|
||||||
|
function TMVCStaticContents.IsStaticFile(AViewPath, AWebRequestPath
|
||||||
: string; out ARealFileName: string): boolean;
|
: string; out ARealFileName: string): boolean;
|
||||||
var
|
var
|
||||||
FileName: string;
|
FileName: string;
|
||||||
@ -1793,7 +1832,8 @@ begin
|
|||||||
FMVCEngine := Value;
|
FMVCEngine := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TMVCBase.GetApplicationFileName: string;
|
class
|
||||||
|
function TMVCBase.GetApplicationFileName: string;
|
||||||
var
|
var
|
||||||
fname: PChar;
|
fname: PChar;
|
||||||
Size: Integer;
|
Size: Integer;
|
||||||
@ -1809,7 +1849,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TMVCBase.GetApplicationFileNamePath: string;
|
class
|
||||||
|
function TMVCBase.GetApplicationFileNamePath: string;
|
||||||
begin
|
begin
|
||||||
Result := IncludeTrailingPathDelimiter
|
Result := IncludeTrailingPathDelimiter
|
||||||
(ExtractFilePath(GetApplicationFileName));
|
(ExtractFilePath(GetApplicationFileName));
|
||||||
|
@ -32,10 +32,11 @@ begin
|
|||||||
.AddController(TTestServerController)
|
.AddController(TTestServerController)
|
||||||
.AddController(TTestServerControllerExceptionAfterCreate)
|
.AddController(TTestServerControllerExceptionAfterCreate)
|
||||||
.AddController(TTestServerControllerExceptionBeforeDestroy);
|
.AddController(TTestServerControllerExceptionBeforeDestroy);
|
||||||
MVCEngine.Config['stompserver'] := 'localhost';
|
MVCEngine.Config[TMVCConfigKey.StompServer] := 'localhost';
|
||||||
MVCEngine.Config['stompserverport'] := '61613';
|
MVCEngine.Config[TMVCConfigKey.StompServerPort] := '61613';
|
||||||
MVCEngine.Config['stompusername'] := 'guest';
|
MVCEngine.Config[TMVCConfigKey.StompUserName] := 'guest';
|
||||||
MVCEngine.Config['stomppassword'] := 'guest';
|
MVCEngine.Config[TMVCConfigKey.StompPassword] := 'guest';
|
||||||
|
MVCEngine.Config[TMVCConfigKey.Messaging] := 'false';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user