Changeset 357


Ignore:
Timestamp:
Apr 29, 2012, 9:41:43 PM (13 years ago)
Author:
chronos
Message:
  • Modified: WebApp is not TComponent instead of TCustomApplication. TApplication in Forms unit is used as base application class.
  • Added: Experimental HTTPServerTurboPower as HTTPServer type which can be used for web application development without external web browser. If used, form with TurboPowerIPro panel will be displayed. This requeire some LCD widgetset other then nogui.
Location:
Network/CoolWeb
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • Network/CoolWeb/CoolWeb.lpk

    r337 r357  
    88      <Version Value="11"/>
    99      <SearchPaths>
     10        <IncludeFiles Value="WebServer"/>
    1011        <OtherUnitFiles Value="WebServer;Persistence;Network;Modules;Common;/usr/lib/mysql/;/usr/lib64/mysql/"/>
    1112        <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    1213      </SearchPaths>
     14      <Parsing>
     15        <SyntaxOptions>
     16          <SyntaxMode Value="Delphi"/>
     17        </SyntaxOptions>
     18      </Parsing>
    1319      <Other>
    1420        <CompilerMessages>
     
    2026    <Description Value="Unit set for generating CGI or server web application."/>
    2127    <License Value="GNU/GPL"/>
    22     <Version Minor="2"/>
    23     <Files Count="16">
     28    <Version Minor="3"/>
     29    <Files Count="18">
    2430      <Item1>
    2531        <Filename Value="WebServer/UHTTPServer.pas"/>
     
    3743      </Item3>
    3844      <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>
    3953        <Filename Value="WebServer/UHTTPSessionFile.pas"/>
    4054        <HasRegisterProc Value="True"/>
    4155        <UnitName Value="UHTTPSessionFile"/>
    42       </Item4>
    43       <Item5>
     56      </Item6>
     57      <Item7>
    4458        <Filename Value="WebServer/UHTTPSessionMySQL.pas"/>
    4559        <HasRegisterProc Value="True"/>
    4660        <UnitName Value="UHTTPSessionMySQL"/>
    47       </Item5>
    48       <Item6>
     61      </Item7>
     62      <Item8>
    4963        <Filename Value="Persistence/USqlDatabase.pas"/>
    5064        <HasRegisterProc Value="True"/>
    5165        <UnitName Value="USqlDatabase"/>
    52       </Item6>
    53       <Item7>
     66      </Item8>
     67      <Item9>
    5468        <Filename Value="Network/UTCPServer.pas"/>
    5569        <UnitName Value="UTCPServer"/>
    56       </Item7>
    57       <Item8>
     70      </Item9>
     71      <Item10>
    5872        <Filename Value="Modules/UPageList.pas"/>
    5973        <UnitName Value="UPageList"/>
    60       </Item8>
    61       <Item9>
     74      </Item10>
     75      <Item11>
    6276        <Filename Value="Modules/UUser.pas"/>
    6377        <UnitName Value="UUser"/>
    64       </Item9>
    65       <Item10>
     78      </Item11>
     79      <Item12>
    6680        <Filename Value="Common/UHtmlClasses.pas"/>
    6781        <UnitName Value="UHtmlClasses"/>
    68       </Item10>
    69       <Item11>
     82      </Item12>
     83      <Item13>
    7084        <Filename Value="Common/UMemoryStreamEx.pas"/>
    7185        <UnitName Value="UMemoryStreamEx"/>
    72       </Item11>
    73       <Item12>
     86      </Item13>
     87      <Item14>
    7488        <Filename Value="Common/UMIMEType.pas"/>
    7589        <UnitName Value="UMIMEType"/>
    76       </Item12>
    77       <Item13>
     90      </Item14>
     91      <Item15>
    7892        <Filename Value="Common/UXmlClasses.pas"/>
    7993        <UnitName Value="UXmlClasses"/>
    80       </Item13>
    81       <Item14>
     94      </Item15>
     95      <Item16>
    8296        <Filename Value="WebServer/UWebPage.pas"/>
    8397        <HasRegisterProc Value="True"/>
    8498        <UnitName Value="UWebPage"/>
    85       </Item14>
    86       <Item15>
     99      </Item16>
     100      <Item17>
    87101        <Filename Value="WebServer/UWebApp.pas"/>
    88102        <HasRegisterProc Value="True"/>
    89103        <UnitName Value="UWebApp"/>
    90       </Item15>
    91       <Item16>
     104      </Item17>
     105      <Item18>
    92106        <Filename Value="LazIDEReg.pas"/>
    93107        <HasRegisterProc Value="True"/>
    94108        <UnitName Value="LazIDEReg"/>
    95       </Item16>
     109      </Item18>
    96110    </Files>
    97111    <Type Value="RunAndDesignTime"/>
    98     <RequiredPkgs Count="6">
     112    <RequiredPkgs Count="8">
    99113      <Item1>
    100         <PackageName Value="IDEIntf"/>
     114        <PackageName Value="TurboPowerIProDsgn"/>
    101115      </Item1>
    102116      <Item2>
    103         <PackageName Value="LCL"/>
     117        <PackageName Value="TurboPowerIPro"/>
    104118      </Item2>
    105119      <Item3>
    106         <PackageName Value="Common"/>
     120        <PackageName Value="IDEIntf"/>
    107121      </Item3>
    108122      <Item4>
     123        <PackageName Value="LCL"/>
     124      </Item4>
     125      <Item5>
     126        <PackageName Value="Common"/>
     127      </Item5>
     128      <Item6>
    109129        <PackageName Value="TemplateGenerics"/>
    110130        <MaxVersion Minor="3"/>
    111131        <MinVersion Minor="3" Valid="True"/>
    112       </Item4>
    113       <Item5>
     132      </Item6>
     133      <Item7>
    114134        <PackageName Value="synapse"/>
    115       </Item5>
    116       <Item6>
     135      </Item7>
     136      <Item8>
    117137        <PackageName Value="FCL"/>
    118138        <MinVersion Major="1" Valid="True"/>
    119       </Item6>
     139      </Item8>
    120140    </RequiredPkgs>
    121141    <UsageOptions>
  • Network/CoolWeb/CoolWeb.pas

    r295 r357  
    33 }
    44
    5 unit CoolWeb; 
     5unit CoolWeb;
    66
    77interface
    88
    99uses
    10   UHTTPServer, UHTTPServerCGI, UHTTPServerTCP, UHTTPSessionFile,
    11   UHTTPSessionMySQL, USqlDatabase, UTCPServer, UPageList, UUser, UHtmlClasses,
    12   UMemoryStreamEx, 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;
    1414
    1515implementation
    1616
    17 procedure Register; 
     17procedure Register;
    1818begin
    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);
     27end;
    2828
    2929initialization
    30   RegisterPackage('CoolWeb', @Register); 
     30  RegisterPackage('CoolWeb', @Register);
    3131end.
  • Network/CoolWeb/WebServer/UWebApp.pas

    r311 r357  
    77uses
    88  Classes, SysUtils, CustApp, SpecializedList, UWebPage, UHTTPSessionFile,
    9   UHTTPServer;
     9  UHTTPServer, Forms;
    1010
    1111type
    12   THTTPServerType = (stCGI, stTCP);
     12  THTTPServerType = (stCGI, stTCP, stTurboPower);
    1313
    1414  TRegistredPage = class
     
    2525  { TWebApp }
    2626
    27   TWebApp = class(TCustomApplication)
     27  TWebApp = class(TComponent)
    2828  private
    2929    FOnBeforePageProduce: TOnProduceEvent;
    3030    FOnInitialize: TNotifyEvent;
    3131    FServerType: THTTPServerType;
    32     procedure DoRun; override;
    3332    function DumpExceptionCallStack(E: Exception): string;
    3433    procedure HTTPServerRequest(HandlerData: THTTPHandlerData);
     
    3938    HTTPSessionStorageFile: THTTPSessionStorageFile;
    4039    LogException: Boolean;
    41     procedure ShowException(E: Exception); override;
     40    procedure ShowException(E: Exception);
    4241    procedure RegisterPage(PageClass: TWebPageClass; out Reference; Path: string);
    4342    constructor Create(AOwner: TComponent); override;
    4443    destructor Destroy; override;
     44    procedure Run;
     45  published
    4546    property OnBeforePageProduce: TOnProduceEvent read FOnBeforePageProduce write FOnBeforePageProduce;
    4647    property OnInitialize: TNotifyEvent read FOnInitialize write FOnInitialize;
     
    5152procedure Register;
    5253
    53 var
    54   Application: TWebApp;
    55 
    56 
    5754implementation
    5855
    5956uses
    60   UHTTPServerCGI, UHTTPServerTCP;
     57  UHTTPServerCGI, UHTTPServerTCP, UHTTPServerTurboPower;
    6158
    6259resourcestring
     
    6663procedure Register;
    6764begin
    68   RegisterClass(TWebApp);
     65  RegisterComponents('CoolWeb', [TWebApp]);
    6966end;
    7067
     
    8481{ TWebApp }
    8582
    86 procedure TWebApp.DoRun;
     83procedure TWebApp.Run;
    8784begin
    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;
    9489end;
    9590
     
    155150    stCGI: HTTPServer := THTTPServerCGI.Create(nil);
    156151    stTCP: HTTPServer := THTTPServerTCP.Create(nil);
     152    stTurboPower: HTTPServer := THTTPServerTurboPower.Create(nil);
    157153  end;
    158154  HTTPServer.OnRequest := HTTPServerRequest;
     
    198194initialization
    199195
    200 Application := TWebApp.Create(nil);
    201 
    202 
    203196finalization
    204 
    205 Application.Free;
    206197
    207198end.
Note: See TracChangeset for help on using the changeset viewer.