Changeset 132 for trunk/Packages/CoolWeb/WebServer/UWebApp.pas
- Timestamp:
- Mar 18, 2022, 3:47:27 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CoolWeb/WebServer/UWebApp.pas
r108 r132 6 6 7 7 uses 8 Classes, SysUtils, CustApp, SpecializedList,UWebPage, UHTTPSessionFile,9 UHTTPServer, Forms, FileUtil ;8 Classes, SysUtils, UWebPage, UHTTPSessionFile, 9 UHTTPServer, Forms, FileUtil, fgl; 10 10 11 11 type … … 22 22 { TPageList } 23 23 24 TPageList = class(T ListObject)24 TPageList = class(TFPGObjectList<TRegistredPage>) 25 25 RootDir: string; 26 26 function FindByPage(Page: TWebPage): TRegistredPage; … … 29 29 procedure UnregisterPage(Page: TWebPage); 30 30 function ProducePage(HandlerData: THTTPHandlerData): Boolean; 31 constructor Create ; override;31 constructor Create(FreeObjects: Boolean = True); 32 32 end; 33 33 … … 64 64 UHTTPServerCGI, UHTTPServerTCP, UHTTPServerTurboPower; 65 65 66 67 66 procedure Register; 68 67 begin … … 77 76 end; 78 77 79 80 78 { TPageList } 81 79 … … 85 83 begin 86 84 I := 0; 87 while (I < Count) and ( TRegistredPage(Items[I]).Page <> Page) do Inc(I);88 if I < Count then Result := TRegistredPage(Items[I])85 while (I < Count) and (Items[I].Page <> Page) do Inc(I); 86 if I < Count then Result := Items[I] 89 87 else Result := nil; 90 88 end; … … 95 93 begin 96 94 I := 0; 97 while (I < Count) and ( TRegistredPage(Items[I]).Name <> Name) do Inc(I);98 if I < Count then Result := TRegistredPage(Items[I])95 while (I < Count) and (Items[I].Name <> Name) do Inc(I); 96 if I < Count then Result := Items[I] 99 97 else Result := nil; 100 98 end; … … 132 130 var 133 131 NewPage: TRegistredPage; 134 Instance: TWebPage; 135 begin 136 NewPage := TRegistredPage(AddNew(TRegistredPage.Create)); 132 begin 133 NewPage := TRegistredPage.Create; 137 134 // NewPage.Page := PageClass.Create(Self); 138 135 NewPage.Page := Page; 139 136 NewPage.Name := Path; 137 Add(NewPage); 140 138 end; 141 139 … … 166 164 constructor TPageList.Create; 167 165 begin 168 inherited Create;169 OwnsObjects := False;166 inherited; 167 FreeObjects := False; 170 168 end; 171 169 … … 212 210 constructor TWebApp.Create(AOwner: TComponent); 213 211 begin 214 inherited Create(AOwner);212 inherited; 215 213 HTTPServer := THTTPServerCGI.Create(nil); 216 214 HTTPServer.OnRequest := HTTPServerRequest; … … 219 217 destructor TWebApp.Destroy; 220 218 begin 221 HTTPServer.Free;222 inherited Destroy;219 FreeAndNil(HTTPServer); 220 inherited; 223 221 end; 224 222
Note:
See TracChangeset
for help on using the changeset viewer.