Line | |
---|
1 | unit HTTPServerTurboPower;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, Forms, HTTPServer, IpHtml;
|
---|
7 |
|
---|
8 | type
|
---|
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 |
|
---|
19 | procedure Register;
|
---|
20 |
|
---|
21 |
|
---|
22 | implementation
|
---|
23 |
|
---|
24 | uses
|
---|
25 | TurboPowerForm;
|
---|
26 |
|
---|
27 | procedure Register;
|
---|
28 | begin
|
---|
29 | RegisterComponents('CoolWeb', [THTTPServerTurboPower]);
|
---|
30 | end;
|
---|
31 |
|
---|
32 | { THTTPServerTurboPower }
|
---|
33 |
|
---|
34 | procedure THTTPServerTurboPower.Run;
|
---|
35 | var
|
---|
36 | HandlerData: THTTPHandlerData;
|
---|
37 | begin
|
---|
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;
|
---|
50 | end;
|
---|
51 |
|
---|
52 | constructor THTTPServerTurboPower.Create(AOwner: TComponent);
|
---|
53 | begin
|
---|
54 | inherited Create(AOwner);
|
---|
55 | Application.CreateForm(TFormWebBrowser, FormWebBrowser);
|
---|
56 | FormWebBrowser.Show;
|
---|
57 | end;
|
---|
58 |
|
---|
59 | destructor THTTPServerTurboPower.Destroy;
|
---|
60 | begin
|
---|
61 | inherited;
|
---|
62 | end;
|
---|
63 |
|
---|
64 | end.
|
---|
65 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.