Configure delegation for application or service
To delegate the start of an application or service to the Genero REST service, specify a
DELEGATE
element in the EXECUTION
component of your application or
service.
The DELEGATE
element requires an attribute called service
. For
the service
attribute, specify the Genero REST service that will be in charge of
all delegated requests for the application or service. The REST service must be correctly configured
in the JGAS.
You can define optional parameters for the REST service to be sent each time a starting request is received. No validation is made for these optional parameters, the REST service must check them and return an error when necessary.
A starting request is a URL with /r
. When you see an application URI with
/sua
, the application has been validated and the delegation REST service is no
longer involved.
Delegate configuration example
<APPLICATION Parent="defaultwa"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.4js.com/ns/gas//cfextwa.xsd">
<EXECUTION>
<PATH>$(res.path)</PATH>
<MODULE>myApp.42r</MODULE>
<DELEGATE service="MyGroup/MyDelegateService">
<anyparameter>MyFirstParameter</anyparameter>
<other>MySecondParameter</other>
</DELEGATE>
</EXECUTION>
</APPLICATION>
GROUP
concept is
not supported, there is no requirement to reference a group in the DELEGATE
element; as you would in the GAS, for example, "<DELEGATE
service="MyGroup/MyDelegateService">
".
<APPLICATION Parent="defaultwa">
<EXECUTION>
<PATH>$(res.path)</PATH>
<MODULE>myApp.42r</MODULE>
<DELEGATE service="MyDelegateService">
<anyparameter>MyFirstParameter</anyparameter>
<other>MySecondParameter</other>
</DELEGATE>
</EXECUTION>
</APPLICATION>
Parameters defined in the DELEGATE
configuration, such as
anyparameter
and other
in this example, are transmitted
to the REST service. See Pass parameters to the REST service for details on the HTTP header syntax and receiving the parameters in the REST
service.
AnyParameter
in the configuration, in the header may
become:x-fourjs-environment-parameter-anyparameter
Therefore, it is not recommended to rely on case in the naming of parameters as there is no guarantee that it will be preserved. When working with HTTP headers in your Genero program code, make sure you allow for this by converting them to either upper or lower case.