-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDW.CORE.DWHandlers.pas
95 lines (78 loc) · 1.96 KB
/
DW.CORE.DWHandlers.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{ *******************************************************************************
DW.CORE.DWApplication contains code from
Project Overbyte ICS http://www.overbyte.be
Delphi Web is
Developped by Delcio Sbeghen @ SRP Sistemas
delcio @ eavnet.com.br (remove spaces)
under MIT Licence
}
unit DW.CORE.DWHandlers;
interface
uses Classes, DWUrlHandlerBase, DWTypes, OverbyteIcsHttpSrv;
type
THttpAllowedElement = class
Path: String;
Flags: TDWHttpAllowedFlag;
end;
THttpDispatchElement = class
Path: String;
Flags: THttpGetFlag;
Proc: Pointer;
SObjClass: TDWUrlHandlerClass;
end;
TDWHttpHandlerList = class(TStringList)
protected
function GetDisp(NItem: Integer): THttpDispatchElement;
public
destructor Destroy; override;
property Disp[NItem: Integer]: THttpDispatchElement read GetDisp;
end;
TDWHttpAllowedPath = class(TStringList)
protected
function GetElem(NItem: Integer): THttpAllowedElement;
public
destructor Destroy; override;
property Elem[NItem: Integer]: THttpAllowedElement read GetElem;
end;
implementation
{ TDWHttpHandlerList }
destructor TDWHttpHandlerList.Destroy;
var
I: Integer;
begin
for I := Count - 1 downto 0 do
begin
if Assigned(Objects[I]) then
begin
Objects[I].Free;
Objects[I] := nil;
end;
Self.Delete(I);
end;
inherited Destroy;
end;
function TDWHttpHandlerList.GetDisp(NItem: Integer): THttpDispatchElement;
begin
Result := Objects[NItem] as THttpDispatchElement;
end;
{ TDWHttpAllowedPath }
destructor TDWHttpAllowedPath.Destroy;
var
I: Integer;
begin
for I := Count - 1 downto 0 do
begin
if Assigned(Objects[I]) then
begin
Objects[I].Free;
Objects[I] := nil;
end;
Self.Delete(I);
end;
inherited Destroy;
end;
function TDWHttpAllowedPath.GetElem(NItem: Integer): THttpAllowedElement;
begin
Result := Objects[NItem] as THttpAllowedElement;
end;
end.