Changeset 357
- Timestamp:
- Apr 29, 2012, 9:41:43 PM (13 years ago)
- Location:
- Network/CoolWeb
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Network/CoolWeb/CoolWeb.lpk
r337 r357 8 8 <Version Value="11"/> 9 9 <SearchPaths> 10 <IncludeFiles Value="WebServer"/> 10 11 <OtherUnitFiles Value="WebServer;Persistence;Network;Modules;Common;/usr/lib/mysql/;/usr/lib64/mysql/"/> 11 12 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 12 13 </SearchPaths> 14 <Parsing> 15 <SyntaxOptions> 16 <SyntaxMode Value="Delphi"/> 17 </SyntaxOptions> 18 </Parsing> 13 19 <Other> 14 20 <CompilerMessages> … … 20 26 <Description Value="Unit set for generating CGI or server web application."/> 21 27 <License Value="GNU/GPL"/> 22 <Version Minor=" 2"/>23 <Files Count="1 6">28 <Version Minor="3"/> 29 <Files Count="18"> 24 30 <Item1> 25 31 <Filename Value="WebServer/UHTTPServer.pas"/> … … 37 43 </Item3> 38 44 <Item4> 45 <Filename Value="WebServer/UHTTPServerTurboPower.pas"/> 46 <UnitName Value="UHTTPServerTurboPower"/> 47 </Item4> 48 <Item5> 49 <Filename Value="WebServer/UTurboPowerForm.pas"/> 50 <UnitName Value="UTurboPowerForm"/> 51 </Item5> 52 <Item6> 39 53 <Filename Value="WebServer/UHTTPSessionFile.pas"/> 40 54 <HasRegisterProc Value="True"/> 41 55 <UnitName Value="UHTTPSessionFile"/> 42 </Item 4>43 <Item 5>56 </Item6> 57 <Item7> 44 58 <Filename Value="WebServer/UHTTPSessionMySQL.pas"/> 45 59 <HasRegisterProc Value="True"/> 46 60 <UnitName Value="UHTTPSessionMySQL"/> 47 </Item 5>48 <Item 6>61 </Item7> 62 <Item8> 49 63 <Filename Value="Persistence/USqlDatabase.pas"/> 50 64 <HasRegisterProc Value="True"/> 51 65 <UnitName Value="USqlDatabase"/> 52 </Item 6>53 <Item 7>66 </Item8> 67 <Item9> 54 68 <Filename Value="Network/UTCPServer.pas"/> 55 69 <UnitName Value="UTCPServer"/> 56 </Item 7>57 <Item 8>70 </Item9> 71 <Item10> 58 72 <Filename Value="Modules/UPageList.pas"/> 59 73 <UnitName Value="UPageList"/> 60 </Item 8>61 <Item 9>74 </Item10> 75 <Item11> 62 76 <Filename Value="Modules/UUser.pas"/> 63 77 <UnitName Value="UUser"/> 64 </Item 9>65 <Item1 0>78 </Item11> 79 <Item12> 66 80 <Filename Value="Common/UHtmlClasses.pas"/> 67 81 <UnitName Value="UHtmlClasses"/> 68 </Item1 0>69 <Item1 1>82 </Item12> 83 <Item13> 70 84 <Filename Value="Common/UMemoryStreamEx.pas"/> 71 85 <UnitName Value="UMemoryStreamEx"/> 72 </Item1 1>73 <Item1 2>86 </Item13> 87 <Item14> 74 88 <Filename Value="Common/UMIMEType.pas"/> 75 89 <UnitName Value="UMIMEType"/> 76 </Item1 2>77 <Item1 3>90 </Item14> 91 <Item15> 78 92 <Filename Value="Common/UXmlClasses.pas"/> 79 93 <UnitName Value="UXmlClasses"/> 80 </Item1 3>81 <Item1 4>94 </Item15> 95 <Item16> 82 96 <Filename Value="WebServer/UWebPage.pas"/> 83 97 <HasRegisterProc Value="True"/> 84 98 <UnitName Value="UWebPage"/> 85 </Item1 4>86 <Item1 5>99 </Item16> 100 <Item17> 87 101 <Filename Value="WebServer/UWebApp.pas"/> 88 102 <HasRegisterProc Value="True"/> 89 103 <UnitName Value="UWebApp"/> 90 </Item1 5>91 <Item1 6>104 </Item17> 105 <Item18> 92 106 <Filename Value="LazIDEReg.pas"/> 93 107 <HasRegisterProc Value="True"/> 94 108 <UnitName Value="LazIDEReg"/> 95 </Item1 6>109 </Item18> 96 110 </Files> 97 111 <Type Value="RunAndDesignTime"/> 98 <RequiredPkgs Count=" 6">112 <RequiredPkgs Count="8"> 99 113 <Item1> 100 <PackageName Value=" IDEIntf"/>114 <PackageName Value="TurboPowerIProDsgn"/> 101 115 </Item1> 102 116 <Item2> 103 <PackageName Value=" LCL"/>117 <PackageName Value="TurboPowerIPro"/> 104 118 </Item2> 105 119 <Item3> 106 <PackageName Value=" Common"/>120 <PackageName Value="IDEIntf"/> 107 121 </Item3> 108 122 <Item4> 123 <PackageName Value="LCL"/> 124 </Item4> 125 <Item5> 126 <PackageName Value="Common"/> 127 </Item5> 128 <Item6> 109 129 <PackageName Value="TemplateGenerics"/> 110 130 <MaxVersion Minor="3"/> 111 131 <MinVersion Minor="3" Valid="True"/> 112 </Item 4>113 <Item 5>132 </Item6> 133 <Item7> 114 134 <PackageName Value="synapse"/> 115 </Item 5>116 <Item 6>135 </Item7> 136 <Item8> 117 137 <PackageName Value="FCL"/> 118 138 <MinVersion Major="1" Valid="True"/> 119 </Item 6>139 </Item8> 120 140 </RequiredPkgs> 121 141 <UsageOptions> -
Network/CoolWeb/CoolWeb.pas
r295 r357 3 3 } 4 4 5 unit CoolWeb; 5 unit CoolWeb; 6 6 7 7 interface 8 8 9 9 uses 10 UHTTPServer, UHTTPServerCGI, UHTTPServerTCP, UHTTPSe ssionFile,11 U HTTPSessionMySQL, USqlDatabase, UTCPServer, UPageList, UUser, UHtmlClasses,12 U MemoryStreamEx, UMIMEType, UXmlClasses, UWebPage, UWebApp, LazIDEReg,13 LazarusPackageIntf;10 UHTTPServer, UHTTPServerCGI, UHTTPServerTCP, UHTTPServerTurboPower, 11 UTurboPowerForm, UHTTPSessionFile, UHTTPSessionMySQL, USqlDatabase, 12 UTCPServer, UPageList, UUser, UHtmlClasses, UMemoryStreamEx, UMIMEType, 13 UXmlClasses, UWebPage, UWebApp, LazIDEReg, LazarusPackageIntf; 14 14 15 15 implementation 16 16 17 procedure Register; 17 procedure Register; 18 18 begin 19 RegisterUnit('UHTTPServerCGI', @UHTTPServerCGI.Register); 20 RegisterUnit('UHTTPServerTCP', @UHTTPServerTCP.Register); 21 RegisterUnit('UHTTPSessionFile', @UHTTPSessionFile.Register); 22 RegisterUnit('UHTTPSessionMySQL', @UHTTPSessionMySQL.Register); 23 RegisterUnit('USqlDatabase', @USqlDatabase.Register); 24 RegisterUnit('UWebPage', @UWebPage.Register); 25 RegisterUnit('UWebApp', @UWebApp.Register); 26 RegisterUnit('LazIDEReg', @LazIDEReg.Register); 27 end; 19 RegisterUnit('UHTTPServerCGI', @UHTTPServerCGI.Register); 20 RegisterUnit('UHTTPServerTCP', @UHTTPServerTCP.Register); 21 RegisterUnit('UHTTPSessionFile', @UHTTPSessionFile.Register); 22 RegisterUnit('UHTTPSessionMySQL', @UHTTPSessionMySQL.Register); 23 RegisterUnit('USqlDatabase', @USqlDatabase.Register); 24 RegisterUnit('UWebPage', @UWebPage.Register); 25 RegisterUnit('UWebApp', @UWebApp.Register); 26 RegisterUnit('LazIDEReg', @LazIDEReg.Register); 27 end; 28 28 29 29 initialization 30 RegisterPackage('CoolWeb', @Register); 30 RegisterPackage('CoolWeb', @Register); 31 31 end. -
Network/CoolWeb/WebServer/UWebApp.pas
r311 r357 7 7 uses 8 8 Classes, SysUtils, CustApp, SpecializedList, UWebPage, UHTTPSessionFile, 9 UHTTPServer ;9 UHTTPServer, Forms; 10 10 11 11 type 12 THTTPServerType = (stCGI, stTCP );12 THTTPServerType = (stCGI, stTCP, stTurboPower); 13 13 14 14 TRegistredPage = class … … 25 25 { TWebApp } 26 26 27 TWebApp = class(TC ustomApplication)27 TWebApp = class(TComponent) 28 28 private 29 29 FOnBeforePageProduce: TOnProduceEvent; 30 30 FOnInitialize: TNotifyEvent; 31 31 FServerType: THTTPServerType; 32 procedure DoRun; override;33 32 function DumpExceptionCallStack(E: Exception): string; 34 33 procedure HTTPServerRequest(HandlerData: THTTPHandlerData); … … 39 38 HTTPSessionStorageFile: THTTPSessionStorageFile; 40 39 LogException: Boolean; 41 procedure ShowException(E: Exception); override;40 procedure ShowException(E: Exception); 42 41 procedure RegisterPage(PageClass: TWebPageClass; out Reference; Path: string); 43 42 constructor Create(AOwner: TComponent); override; 44 43 destructor Destroy; override; 44 procedure Run; 45 published 45 46 property OnBeforePageProduce: TOnProduceEvent read FOnBeforePageProduce write FOnBeforePageProduce; 46 47 property OnInitialize: TNotifyEvent read FOnInitialize write FOnInitialize; … … 51 52 procedure Register; 52 53 53 var54 Application: TWebApp;55 56 57 54 implementation 58 55 59 56 uses 60 UHTTPServerCGI, UHTTPServerTCP ;57 UHTTPServerCGI, UHTTPServerTCP, UHTTPServerTurboPower; 61 58 62 59 resourcestring … … 66 63 procedure Register; 67 64 begin 68 RegisterC lass(TWebApp);65 RegisterComponents('CoolWeb', [TWebApp]); 69 66 end; 70 67 … … 84 81 { TWebApp } 85 82 86 procedure TWebApp. DoRun;83 procedure TWebApp.Run; 87 84 begin 88 try 89 if Assigned(FOnInitialize) then FOnInitialize(Self); 90 HTTPServer.Run; 91 finally 92 Terminate; 93 end; 85 if Assigned(FOnInitialize) then FOnInitialize(Self); 86 HTTPServer.Run; 87 if (ServerType = stCGI) or (ServerType = stTCP) then 88 Application.Terminate; 94 89 end; 95 90 … … 155 150 stCGI: HTTPServer := THTTPServerCGI.Create(nil); 156 151 stTCP: HTTPServer := THTTPServerTCP.Create(nil); 152 stTurboPower: HTTPServer := THTTPServerTurboPower.Create(nil); 157 153 end; 158 154 HTTPServer.OnRequest := HTTPServerRequest; … … 198 194 initialization 199 195 200 Application := TWebApp.Create(nil);201 202 203 196 finalization 204 205 Application.Free;206 197 207 198 end.
Note:
See TracChangeset
for help on using the changeset viewer.