Application environment

When the Genero Application Server starts an application process, it sets environment variables from various sources. Understanding how variables are defined by the various front-ends, is helpful to you when configuring applications.

The application process can be started as a DVM (fglrun), as an intermediate script, or whatever is specified in the application configuration file.

Environment inheritance

Environment variable settings are inherited by the DVM in the following order:

  1. The environment of the dispatcher that starts the proxy.
  2. The environment variables defined in the application configuration file (ENVIRONMENT_VARIABLE elements).
  3. Additionally, some specific environment variables can be defined by the front-end; whether this is Genero Desktop Client, Genero Web Client. See:

How GDC and GWC handle environment variables

With Genero Desktop Client and Genero Web Client applications, variables can be set in the HTTP request that starts the application. All HTTP request headers will be transformed into environment variables, by adding the FGL_WEBSERVER_HTTP_ prefix.

Note: Dash (or minus) (-) characters are replaced by underscore (_) characters. For example, the header "User-Agent" will define the FGL_WEBSERVER_HTTP_USER_AGENT environment variable.
The following exceptions are supported for backward compatibility:
  • FGL_WEBSERVER_REMOTE_USER holds the REMOTE_USER value provided by the Web Server.
  • FGL_WEBSERVER_REMOTE_ADDR holds the REMOTE_ADDR value provided by the Web Server.

How GWS handle HTTP request headers

With Genero Web Services applications, environment variables cannot be used to pass HTTP request headers. Low-level APIs are used to retrieve values from the HTTP request headers. The header name has the following form:

X-FourJs-Environment-Parameter-name

Where name is the header name. To get the header value, you must use the com.HTTPRequest.getRequestHeader() method. For example:
LET param = req.getRequestHeader("X-FourJs-Environment-Parameter-MyHeaderName") 
The server name can be found in X-FourJs-Environment-Variable-SERVER_NAME.
Note: For more information on com.HTTPRequest methods, please see the Web services classes chapter in the Genero Business Development Language User Guide.

How GWS with delegation handles HTTP request headers

When delegation is used in Genero Web Services, the X-FourJs-Environment-Parameter-<parameter_name> is used by the delegate mechanism to pass any additional parameters defined in the as.xcf file of the application to the delegate service. For instance, in the following xcf delegation setting example using Security Assertion Markup Language (SAML) service :
<DELEGATE service="services/SAMLServiceProvider">
  <IDFORMAT>ABC</IDFORMAT>
  <AUTHCONTEXT>123</AUTHCONTEXT>
</DELEGATE>
The parameters IDFORMAT and AUTHCONTEXT are free, and can be passed to the delegate service as HTTP headers in the following form:

X-FourJs-Environment-Parameter-IDFORMAT : ABC

X-FourJs-Environment-Parameter-AUTHCONTEXT : 123