Four Js Development Tools Forum

Discussions by product => GAS and GBC => Topic started by: Carl P. on March 13, 2018, 04:08:14 pm



Title: Getting the base URL of an application
Post by: Carl P. on March 13, 2018, 04:08:14 pm
We have an application running Genero 3.10 with GAS and GBC.

I need to find the base URL of the application when it's running in the browser. So on my development laptop I'm running the application using httpdispatch and the URL is:

http://localhost:6394/ua/r/penmast_82

The application generates a text file that is available to the browser at:

http://localhost:6394/per_unp_dublin8_admin_07032018_152702_7036.txt

I then need to pass it to a .NET application as a parameter:

http://dubpm/LPMailMergeSetup/MailMerge.aspx?source=http://localhost:6394/per_unp_dublin8_admin_07032018_152702_7036.txt

I've looked in both the base.Application and ui.Interface classes but can't see anything that will do the job.

Is there anything that will return the base part of the URL?

Thanks,

Carl D. Patterson
Senior Developer
L&P Systems Limited


Title: Re: Getting the base URL of an application
Post by: Reuben B. on March 13, 2018, 08:58:22 pm
In your dev environment experiment by adding the following near the beginning of your program

 
Code
  1. run "env | grep 'FGL' | sort > /tmp/carl.env"

you will see a number of environment variables beginning FGL_ are populated by the dispatcher and proxy process.  Your program can then read the appropriate environment variable(s) with FGL_GETENV


Title: Re: Getting the base URL of an application
Post by: Frank G. on March 14, 2018, 09:13:25 am
Hi, if you are behind a GAS, you should have the environment variable called FGL_VMPROXY_START_URL . The initial URL launched to start you app. Then you can find the base URL by removing the /ua/r part .

ex: LET startURL = fgl_getenv("FGL_VMPROXY_START_URL")


Title: Re: Getting the base URL of an application
Post by: David H. on March 14, 2018, 11:03:58 am
You might also find http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_wshelper_spliturl.html (http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_wshelper_spliturl.html) useful


Title: Re: Getting the base URL of an application
Post by: Leo S. on March 14, 2018, 11:35:21 am
also possible: os.Path.dirname
It has the advantage over WSHelper that it doesn't load a full GWS dll (in case you didn't use GWS elsewhere in your program)

IMPORT os
MAIN
  --os.Path.dirname(os.Path.dirname(os.Path.dirname(fgl_getenv("FGL_VMPROXY_START_URL"))))
  DISPLAY os.Path.dirname(os.Path.dirname(os.Path.dirname("https://yourserver.com:443/gas/ua/r/yourprogram")))
END MAIN


Title: Re: Getting the base URL of an application
Post by: Carl P. on March 15, 2018, 03:58:55 pm
There's lots of good stuff in those environment variables that I hadn't seen before.

Thanks everyone,

Carl