Changeset 130 for trunk/Application/UWebSession.pas
- Timestamp:
- Mar 18, 2022, 1:32:32 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UWebSession.pas
r115 r130 34 34 end; 35 35 36 36 37 implementation 37 38 … … 43 44 resourcestring 44 45 SError = '<div>Error: %s</div>'; 45 46 46 47 47 { TWebSession } … … 86 86 ModuleManager.StartInstalled; 87 87 88 try 89 BaseUrlParts := TListString.Create; 90 BaseUrlParts.Explode(BaseURL, '/', StrToStr); 91 while (BaseUrlParts.Count > 0) and (Request.Path.Count > 0) and 92 (BaseUrlParts[0] = Request.Path[0]) do begin 93 BaseUrlParts.Delete(0); 94 Request.Path.Delete(0); 95 end; 96 finally 97 BaseUrlParts.Free; 88 try 89 BaseUrlParts := TListString.Create; 90 BaseUrlParts.Explode(BaseURL, '/', StrToStr); 91 while (BaseUrlParts.Count > 0) and (Request.Path.Count > 0) and 92 (BaseUrlParts[0] = Request.Path[0]) do begin 93 BaseUrlParts.Delete(0); 94 Request.Path.Delete(0); 98 95 end; 99 if Request.Path.Count > 0 then PageName := Request.Path[0] 100 else PageName := ''; 101 ModuleBase := TModuleBase(ModuleManager.FindModuleByName('Base')); 102 Page := ModuleBase.Pages.FindByName(PageName); 103 if Assigned(Page) then begin 104 try 105 Page.Page.OnProduce(Self); 106 except 107 on E: Exception do begin 108 THTMLString(Self.HtmlDocument.Body.SubItems.AddNew(THtmlString.Create)). 109 Text := Format(SError, [E.Message]); 110 GeneratePage(Page.Page); 111 end; 112 end; 113 end else begin 114 Core.WebApp1.HTTPServer.FileResponse(Self) 96 finally 97 BaseUrlParts.Free; 98 end; 99 if Request.Path.Count > 0 then PageName := Request.Path[0] 100 else PageName := ''; 101 ModuleBase := TModuleBase(ModuleManager.FindModuleByName('Base')); 102 Page := ModuleBase.Pages.FindByName(PageName); 103 if Assigned(Page) then begin 104 try 105 if Assigned(Page.Page) then Page.Page.OnProduce(Self); 106 except 107 on E: Exception do begin 108 THTMLString(Self.HtmlDocument.Body.SubItems.AddNew(THtmlString.Create)). 109 Text := Format(SError, [E.Message]); 110 GeneratePage(Page.Page); 115 111 end; 112 end; 113 end else begin 114 Core.WebApp1.HTTPServer.FileResponse(Self) 115 end; 116 116 end; 117 117 … … 124 124 GlobalTitle := 'WebSystem'; 125 125 126 //Page.Page.OnProduce(HandlerData); 127 HtmlDocument.Title := Page.Caption; 128 with HtmlDocument.AsXmlDocument do 129 try 130 Formated := TCore(MainModule).FormatHTML; 131 Response.Content.WriteString(AsString); 132 finally 133 Free; 134 end; 126 //Page.Page.OnProduce(HandlerData); 127 HtmlDocument.Title := Page.Caption; 128 with HtmlDocument.AsXmlDocument do 129 try 130 Formated := TCore(MainModule).FormatHTML; 131 Response.Content.WriteString(AsString); 132 finally 133 Free; 135 134 end; 135 end; 136 136 end; 137 138 137 139 138 procedure TWebSession.InitDatabase;
Note:
See TracChangeset
for help on using the changeset viewer.