Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Getting the base URL of an application  (Read 5553 times)
Carl P.
Posts: 9


« 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
Reuben B.
Four Js
Posts: 844


« Reply #1 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

Register for WWDC 21 at https://4js.com/wwdc21online/

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Frank G.
Four Js
Posts: 41


« Reply #2 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")
David H.
Posts: 158


« Reply #3 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 useful
Leo S.
Four Js
Posts: 104


« Reply #4 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
Carl P.
Posts: 9


« Reply #5 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
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines