| Welcome, Guest |
You have to register before you can post on our site.
|
| Latest Threads |
Simply convert PeerIp to ...
Forum: Indy
Last Post: DidierMenant
Yesterday, 03:50 PM
» Replies: 2
» Views: 129
|
New CGDevTools build is a...
Forum: CGDevTools
Last Post: lfeliz
Yesterday, 12:03 AM
» Replies: 2
» Views: 1,322
|
How to terminate HTTP Thr...
Forum: Indy
Last Post: rlebeau
08-02-2026, 04:21 PM
» Replies: 3
» Views: 127
|
IW 16.2.0 Missing librari...
Forum: IntraWeb General Discussion
Last Post: JuergenS
07-31-2026, 09:44 AM
» Replies: 6
» Views: 1,208
|
Datatables question
Forum: IntraWeb General Discussion
Last Post: Alexandre Machado
07-28-2026, 04:34 AM
» Replies: 2
» Views: 210
|
CSS file not reloading af...
Forum: IntraWeb General Discussion
Last Post: CharlieDunn
07-27-2026, 08:27 PM
» Replies: 1
» Views: 345
|
Intraweb components missi...
Forum: IntraWeb General Discussion
Last Post: valmeras
07-27-2026, 03:18 PM
» Replies: 3
» Views: 342
|
Image question on tiwjqdb...
Forum: IntraWeb General Discussion
Last Post: alex.trejo@tttnet.com.mx
07-17-2026, 05:18 PM
» Replies: 6
» Views: 4,815
|
IW 16.1.9 Invalid propert...
Forum: IntraWeb General Discussion
Last Post: Blanca80
07-17-2026, 08:06 AM
» Replies: 7
» Views: 2,347
|
Bootstrap5
Forum: IntraWeb General Discussion
Last Post: Alexandre Machado
07-17-2026, 03:38 AM
» Replies: 2
» Views: 692
|
|
|
| Problem with cache and 404 error |
|
Posted by: troberts - 03-25-2024, 01:54 AM - Forum: IntraWeb General Discussion
- Replies (1)
|
 |
Hi,
I have an IW application which is sometimes called with a parameter in the URL.
https://mycompany.com/$/start/myparam
The first time I call this it works fine. In the ServerController the BeforeDispatch event is called, then AfterDispatch, then UserSessionBaseCreate,
then ServerControllerBaseNewSession, then the main form is displayed.
But, the second time I call it only the ServerController BeforeDispatch and AfterDispatch events are fired. Nothing else. Then the browser displays a 404 error. If I open a second tab in the browser and clear the cache I can return to the first tab, refresh it and everything is normal.
In the ServerControllerBeforeDispatch event, I am setting aReply.AllowCaching to false. I've also experimented with including the following lines:
// aReply.Headers.Add('Cache-control: no-cache');
// aReply.Headers.Add('Cache-control: no-store');
// aReply.Headers.Add('Pragma: no-cache');
// aReply.Headers.Add('Expires: 0');
None of them make any difference. Subsequent calls to https://mycompany.com/$/start/myparam result in a 404 error. This lasts until either the browser cache is cleared or the IW server is restarted.
Any ideas?
Thanks,
Tim
|
|
|
| IWModalWindow from different Sessions |
|
Posted by: bjoernb - 03-24-2024, 10:52 PM - Forum: IntraWeb General Discussion
- Replies (1)
|
 |
Hey everybody,
i need your help.
Problem:
MainForm can load multiple Frames and on opening another one, the old one got deleted. This way it worked Pretty well.
Customer now said they sometimes need to check some Information on Frame B while editing on Frame A, so deleting the Frame is not an Option anymore.
Setting Frames to Invisible didn't do anything at all, so i set the Parent to NULL instead.
The Edit Menu is opened in a ModalWindow.
Problem is, when i opened A first, then B (means A is in background), and then try to open the Edit Menu on Frame B, the ModalWindow is locked behind Frame A, means i can't see it.
i tried to fix it (and failed) by copying the ModalWindow to MainForm.
But when i try to open it from here, it just loads a blank window, no data, no Close button, nothing. This always occurs once there's any Frame loaded and i try to open a ModalWindow in MainForm.
Do you guys have any Idea how to fix this?
Greetings,
Bjoern
|
|
|
| IWjQGrid get value from Grid |
|
Posted by: medzoom - 03-15-2024, 02:01 PM - Forum: IntraWeb General Discussion
- Replies (2)
|
 |
I didnt find a solution in the demo-file, but how do I read the value of an consisting jQGrid?
I try to react to a doubleClick, first .cell[1,1]-call raises an exception and second .DoGridGetCell(..)-call gives a empty string back?
In the TMS-Sourcecode the is an function .cells but with IntraWeb there isn't?
Code: procedure TIWFrame1.IWjQGrid1AsyncDblClickRow(Sender: TObject;
EventParams: TStringList; const RowID: string; const Row, Col: Integer);
var
text1, text2, text3 : string;
begin
text3 := IWjQGrid1.Columns[1].DisplayName;
text1 := IWjQGrid1.Cell[1,1];
text2 := IWjQGrid1.DoGridGetCell(RowID, 'Column1');
end;
|
|
|
| Support wwwroot and templates files from application resources |
|
Posted by: ccy - 03-13-2024, 10:21 AM - Forum: IntraWeb General Discussion
- Replies (1)
|
 |
When deploy intraweb application using wwwroot and templates, 2 extra folders wwwroot and templates shall deploy to same folder stored the application executable file.
Windows or Delphi application support resources stored in .EXE or .DLL / .BPL, it would be nice if IntraWeb can support loading those files from application resource to avoid deploy extra files at runtime.
I submitted a patch to support loading the templates from TResourceStream for your reference:
Code: unit IWTemplateProcessorHTML.ResourcePatch;
interface
uses
System.Classes, System.SysUtils;
var LoadTemplateEx: TFunc<string, TStream>;
implementation
uses
System.Types,
DDetours, IW.Common.StrLists, IW.Common.Stream, IW.Common.Strings,
IW.Common.Threads, IWFilePath, IWGlobal, IWTemplateProcessorHTML;
type
TIWTemplateCacheAccess = class
private
mFiles: TIWStringList;
mLock: TIWSlimReaderWriter;
end;
TIWTemplateCacheHelper = class helper for TIWTemplateCache
class function FindItem_Address: Pointer;
class function Load_Address: Pointer;
function Load_Patch(const aFileName: string; aRefreshFromFile: Boolean): TStream;
end;
TIWTemplateProcessorHTMLHelper = class helper for TIWTemplateProcessorHTML
function Able_Patch: Boolean;
function TemplatePathname_Patch: string;
end;
var TIWTemplateProcessorHTML_Able: function(Self: TIWTemplateProcessorHTML): Boolean;
var TIWTemplateProcessorHTML_TemplatePathname: function(Self: TIWTemplateProcessorHTML): string;
var TIWTemplateCache_FindItem: function(Self: TIWTemplateCache;
const aFileName: string): TIWTemplateCacheItem = nil;
var TIWTemplateCache_Load: function(Self: TIWTemplateCache;
const aFileName: string; aRefreshFromFile: Boolean): TStream;
class function TIWTemplateCacheHelper.FindItem_Address: Pointer;
begin
Result := @TIWTemplateCache.FindItem;
end;
class function TIWTemplateCacheHelper.Load_Address: Pointer;
begin
Result := @TIWTemplateCache.Load;
end;
function TIWTemplateCacheHelper.Load_Patch(const aFileName: string;
aRefreshFromFile: Boolean): TStream;
var
LStream: TIWMemoryStream;
Item: TIWTemplateCacheItem;
begin
Result := nil;
(* patched: if FileExists(aFilename) then*) begin
(* patched: LStream := TIWMemoryStream.Create;
try
TIWMemoryStream(LStream).LoadFromFile(aFileName);
except
FreeAndNil(LStream);
raise;
end;*)
var sFileName := ExtractFileName(aFileName);
var o := LoadTemplateEx(sFileName);
try
LStream := TIWMemoryStream.CreateCopy(o, 0);
finally
o.Free;
end;
if aRefreshFromFile or not Able then Exit(LStream);
Item := TIWTemplateCacheItem.Create(LStream);
try
// we are going to return a copy of the stream
Result := LStream.Clone;
// the original LStream is going to be stored in our cache
TIWTemplateCacheAccess(Self).mLock.BeginWrite;
try
TIWTemplateCacheAccess(Self).mFiles.AddObject(aFileName, Item); // add the stream to the cache
finally
TIWTemplateCacheAccess(Self).mLock.EndWrite;
end;
except
FreeAndNil(Item);
raise;
end;
end;
end;
function TIWTemplateProcessorHTMLHelper.Able_Patch: Boolean;
begin
(* patched
Result := False;
if Enabled then begin
Result := Assigned(FOnBeforeProcess) or FileExists(TemplatePathname);
end;
*)
Result := True;
end;
function TIWTemplateProcessorHTMLHelper.TemplatePathname_Patch: string;
var
S: string;
begin
if Templates.Default = '' then begin
// This is for subtemplates of regions. Right now containername returns:
// formName.regionName. We rename it to formNameRegionName and that way
// if no name is specified for the templates for regions, it uses this as
// the default one
if Assigned(Container) then begin
// Remove the T from subclass name (AFTER the .)
if (s <> '') and (Pos('.T', UpperCase(s)) > 0) then begin
s := IWStringReplace(UpperCase(Container.ContainerClassName), '.T', '', []);
end;
s := IWStringReplace(Container.ContainerClassName, '.', '', []);
// Remove T from it
if IWStartsText('T', s) then begin
Delete(s, 1, 1);
end;
s := s + '.html';
end else begin
s := '';
end;
(* patched if Assigned(gSC) and FileExists(gSC.TemplateDir + s) then *)begin
FTemplates.Default := s;
end;
end;
if Templates.Default <> '' then begin
Result := Templates.Default;
end;
Result := TFilePath.Concat(gSC.TemplateDir, Result);
end;
initialization
TIWTemplateProcessorHTML_Able := InterceptCreate(@TIWTemplateProcessorHTML.Able, @TIWTemplateProcessorHTML.Able_Patch);
TIWTemplateProcessorHTML_TemplatePathname := InterceptCreate(@TIWTemplateProcessorHTML.TemplatePathname, @TIWTemplateProcessorHTML.TemplatePathname_Patch);
TIWTemplateCache_Load := InterceptCreate(TIWTemplateCache.Load_Address, @TIWTemplateCache.Load_Patch);
finalization
InterceptRemove(@TIWTemplateProcessorHTML_Able);
InterceptRemove(@TIWTemplateProcessorHTML_TemplatePathname);
InterceptRemove(@TIWTemplateCache_Load);
end.
|
|
|
| Please support THandlers.Delete method in unit IW.Content.Handlers.pas |
|
Posted by: ccy - 03-13-2024, 10:14 AM - Forum: IntraWeb General Discussion
- Replies (2)
|
 |
In unit IW.Content.Handlers.pas, THandlers.Add method is available but there is no Delete method to remove TContentBase handler.
It is useful for application deployed with dynamic packages so we can write something like this:
Code: initialization
THandlers.Add('/register/', '', TContent_Register.Create);
finalization
THandlers.Delete('/register/', '');
end.
A patch for reference:
Code: unit IW.Content.Handlers.Patch;
interface
uses
IW.Content.Handlers;
type
THandlersHelper = class helper for THandlers
class procedure Delete(const aPath, aDocument: string);
end;
implementation
uses
System.SysUtils,
IW.Common.Strings, IWServerControllerBase;
class procedure THandlersHelper.Delete(const aPath, aDocument: string);
var i: Integer;
xPath: string;
begin
TIWServerControllerBase.CheckLockGlobal('Handlers.Delete');
if (aPath = '') and (aDocument = '') then begin
raise Exception.Create('Path and Document cannot both be empty.');
end;
// xPath
// -Path + Document: /mypath/mydoc.html
// -Path + Extension: /mypath/*.zat
// -Path: /mypath/
// -Document: mydoc.html
// -Extension: *.zat
if aPath = '' then begin
xPath := aDocument;
end else begin
if not IWStartsText('/', aPath) then begin
raise Exception.Create('Path must start with /');
end else
if (Length(aPath) > 1) and not IWEndsText('/', aPath) then begin // if aPath = '/', StrUtils.EndsText() returns false for EndsText('/', aPath)!!!
raise Exception.Create('Path must end with /');
end;
xPath := aPath + aDocument;
end;
if mList.Find(xPath, i) then
mList.Delete(i);
end;
end.
|
|
|
| Closing a TCP/IP component connection the right way |
|
Posted by: Ahmed Sayed - 03-12-2024, 04:08 PM - Forum: Indy
- Replies (7)
|
 |
Hi,
Let's say that, I have a TCP component with its connection opened with the server, whether it is TIdTCPClient, TIdHTTP, TIdFTP, etc. What is the correct way to close the connection without raising any exception especially if the server went down before doing so?
I know that all of these classes inherit from TIdTCPClientCustom so there must be a common way to close them on that class level.
The idea here is that I want to create something similar to std::unique_lock, std::unique_ptr, and std::lock_guard. Let's call it unique_connection<T> for instance. So, regardless of the template T which can be any class that inherits from TIdTCPClientCustom, whenever unique_connection goes out of scope it will close the connection without raising any exceptions whether the server is still running or not.
I need this to make sure that there are no resources like sockets, or connections that are still open before the client gets destroyed.
|
|
|
| session timeout thread |
|
Posted by: ebob42 - 03-12-2024, 11:46 AM - Forum: IntraWeb General Discussion
- Replies (1)
|
 |
IntraWeb 15.5.x has made a significant positive change by introducing the TSentinelThread in the ServerController, to watch the internal workings of the session timeout thread activity, and the sentinel thread will restart it when needed. Although there is no way to know for sure (there is no message or output that the TSentinalThread has actually restarted the session timeout thread), we have not encountered situations where sessions were no longer destroyed.
Except... for a relative new situation, where one thread is using 25% CPU (we have 4 -core servers), and it looks like this may be the session timeout thread, since new session can still be created, but older sessions are no longer destroyed. And after a few hours, this leads to hundreds of extra sessions and memory overhead.
Could it be that the session timeout thread is locking some resource, and waiting for another reasons to become available? In other words, could this be a deadlock situation?
The next time this happens, I will attempt to kill the thread that takes 25% CPU. If this is indeed the session timeout thread, then hopefully the sentinel thread will restart it (although this will leave the locked resources probably still locked, so there's a big chance we'll end up in the same deadlock situation again.
If you have anything that could help us pinpoint or resolve this problem, we would be very grateful. Thanks.
Groetjes, Bob Swart
|
|
|
|