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