Jump to content

HTTPCommand / UniApplication HELP !


CastleSoft

Recommended Posts

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

 

 

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...