Jump to content

Creating/formatting a URL in unigui application?


mos

Recommended Posts

A customer has developed a small program that implements a protocol and that program needs to receive a full url to the a file in the cache folder...

 

      'http://70.60.ZZZ.XXX:8077' + audioUrl

 

where 'audioUrl' is the file to be downloaded from /cache/...

 

code wise, I can build most of the URL with

 

url := 'http';

if UniServerModule.SSLEnabled then

  url := url + 's';

{how to get the host part programatically?!?}

url := url + ':' + intToStr(UniServerModule.Port);

url := url + audioUrl;

 

my worst case scenari is to have the user define this somewhere as an attribute which would used something like

 

 

url := config.url + ':' + intToStr(UniServerModule.Port);

url := url + audioUrl;

 

where config.url is a function that reads a value from the database, but in the case of the above example would return

 

http://70.60.ZZZ.XXX

 

Is there some property that contains the host part of the url? Thanks.
 

Link to comment
Share on other sites

If I understand the problem correctly:

UniSession.URL

Will return:

http://123.123.123.123:8077

or 

http://123.123.123.123:8077/m

 

if you need all parameters

// =============================================================================
function rtnAllParms(): String;
var
  i: Integer;
  p: String;
begin
  for i := 0 to UniApplication.Parameters.count - 1 do
  begin
    if (i = 0) then
      p := p + '?'
    else
      p := p + '&';

    p := p + UniApplication.Parameters[i];
  end;
  result := p;
end;
Link to comment
Share on other sites

  • 2 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...