PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/components/fpweb/demo/echo/wmecho.pp

http://github.com/graemeg/lazarus
Pascal | 58 lines | 34 code | 16 blank | 8 comment | 0 complexity | d8725fc0d86742f2458c32a562ca52df MD5 | raw file
 1unit wmecho;
 2
 3{$mode objfpc}{$H+}
 4
 5interface
 6
 7uses
 8  Classes, SysUtils, LResources, HTTPDefs, websession, fpHTTP,
 9  fpWeb;
10
11type
12
13  { TEchoModule }
14
15  TEchoModule = class(TFPWebModule)
16    procedure EchoModuleRequest(Sender: TObject; ARequest: TRequest;
17      AResponse: TResponse; var Handled: Boolean);
18  private
19    { private declarations }
20  public
21    { public declarations }
22  end; 
23
24var
25  EchoModule: TEchoModule;
26
27implementation
28
29uses webutil;
30
31{ TEchoModule }
32
33procedure TEchoModule.EchoModuleRequest(Sender: TObject; ARequest: TRequest;
34  AResponse: TResponse; var Handled: Boolean);
35  
36Var
37  S : TStrings;
38  
39begin
40  S:=TStringList.Create;
41  try
42    // Analyze request.
43    DumpRequest(ARequest,S);
44    // Optional, because default.
45    AResponse.ContentType:='text/html';
46    AResponse.Contents:=S;
47    Handled:=True;
48  finally
49    S.Free;
50  end;
51end;
52
53initialization
54  {$I wmecho.lrs}
55
56  RegisterHTTPModule('echo', TEchoModule);
57end.
58