source: trunk/Packages/CoolWeb/WebServer/UHTTPServerTurboPower.pas

Last change on this file was 5, checked in by chronos, 12 years ago
  • Added: Required packages.
File size: 1.3 KB
Line 
1unit UHTTPServerTurboPower;
2
3{$mode delphi}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, Forms, UHTTPServer, IpHtml;
9
10type
11
12 { THTTPServerTurboPower }
13
14 THTTPServerTurboPower = class(THTTPServer)
15 public
16 procedure Run; override;
17 constructor Create(AOwner: TComponent); override;
18 destructor Destroy; override;
19 end;
20
21procedure Register;
22
23
24implementation
25
26uses
27 UTurboPowerForm;
28
29procedure Register;
30begin
31 RegisterComponents('CoolWeb', [THTTPServerTurboPower]);
32end;
33
34
35{ THTTPServerTurboPower }
36
37procedure THTTPServerTurboPower.Run;
38var
39 HandlerData: THTTPHandlerData;
40begin
41 inherited Run;
42 HandlerData := THTTPHandlerData.Create;
43 with HandlerData do try
44 // Execute content handler
45 if Assigned(OnRequest) then OnRequest(HandlerData)
46 else raise EEmptyHTTPHandler.Create(SEmptyHTTPHandler);
47 Response.Content.Position := 0;
48 FormWebBrowser.HtmlSource := Response.Content.ReadString;
49 FormWebBrowser.IpHtmlPanel1.SetHtmlFromStr(FormWebBrowser.HtmlSource);
50 finally
51 Free;
52 end;
53end;
54
55constructor THTTPServerTurboPower.Create(AOwner: TComponent);
56begin
57 inherited Create(AOwner);
58 Application.CreateForm(TFormWebBrowser, FormWebBrowser);
59 FormWebBrowser.Show;
60end;
61
62destructor THTTPServerTurboPower.Destroy;
63begin
64 inherited Destroy;
65end;
66
67end.
68
Note: See TracBrowser for help on using the repository browser.