CastleSoft Posted September 9, 2015 Share Posted September 9, 2015 I am trying to work around the uniGui single application/url design at the moment for a client. My HACK is: 1) Create a HTTPCommand which when it receives the /urlpath does a redirect as a query Param of '/?cmd=urlpath 2) The FormShow detects cmd=urlpath and shows a windows/loads a frame/etc. procedure TUniServerModule.UniGUIServerModuleHTTPCommand( ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean); begin if (ARequestInfo.URI = '/test') then begin AResponseInfo.ResponseNo := 302; AResponseInfo.Location := '/?cmd=test'; Handled := true; end; end; procedure TMainForm.UniFormShow(Sender: TObject); begin if (UniApplication.Parameters.Values['cmd'] = 'test') then begin // Stuff goes here.. end; end; Now this works ok.. BUT.. ie. http://mysite.com/about becomes http://mysite.com/?cmd=about It would be nice if I could not redirect, say its handled and then query the URL in the FormShow ? Is it possible ? ie. procedure TUniServerModule.UniGUIServerModuleHTTPCommand( ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean); begin if (ARequestInfo.URI = '/test') then begin Handled := true; // OTHER Magic goes here ??? // If I do nothing, an empty page is displayed.. // I want HANDLED but the default MAIN to still load, not a blank. // And the FormShow can work out what window to popup etc.. or frame or html to load etc. end; end; procedure TMainForm.UniFormShow(Sender: TObject); begin if (UniApplication.????? = '/test') then begin ShowMessage('......'); end; end Quote Link to comment Share on other sites More sharing options...
itognet Posted February 1, 2017 Share Posted February 1, 2017 Did you find a solution to this ? Quote Link to comment Share on other sites More sharing options...
Jancarlos Martins Posted September 5, 2019 Share Posted September 5, 2019 Yes, it's possible. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.