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

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