adua.xrd usage example

This topic explains an automatic user agent discovery configuration example.

Attention: As of Genero version 3.00, the Snippet-Based Rendering Engine (SBRE) and all themes using template paths are deprecated. Output maps (e.g. DUA_HTML5) are no longer used to specify output theme, as the wa protocol did previously. For information on how templates and snippets were used by the front-ends, please refer to the Genero Application Server 2.50 User Guide.

For new development, use Genero Browser Client, see Genero Web Client for JavaScript (GWC-JS).

Suppose you want to use the DUA_GDC output map for Internet Explorer browsers and DUA_XXX for all other user agents. To achieve this, you have to configure your application to support both Output Maps.

In your GAS configuration file (as.xcf), add an OUTPUT element with a rule identified by UseAllOutputDriver, defining the rendering and theme for two MAP elements identified by the DUA_GDC and DUA_XXX names:

<APPLICATION Id="test" Parent="defaultwa">
  <EXECUTION>
    <PATH>$(res.path.fgldir.demo)</PATH>
    <MODULE>demo.42r</MODULE>
  </EXECUTION>
  <OUTPUT Rule="UseAllOutputDriver">
    <MAP Id="DUA_XXX" Allowed="TRUE">
      <RENDERING Using="cpn.rendering.wa"/>
      <THEME Using="cpn.theme.default.xxx"/>
    </MAP>
    <MAP Id="DUA_GDC" Allowed="TRUE">
      <RENDERING Using="cpn.rendering.wa"/>
      <THEME Using="cpn.theme.default.gdc"/>
    </MAP>
  </OUTPUT>
</APPLICATION>

In the adua.xrd file, define the UseAllOutputDriver rule to associate a User-Agent type to a MAP element defined in the as.xcf file:

<RULE Id="UseAllOutputDriver">
  <TABLE Id="1" Key="User-Agent">
    <ROW>
      <IN>MSIE</IN>
      <ACTION Type="RESULT">DUA_GDC</ACTION>
    </ROW>
    <ROW>
      <ACTION Type="RESULT">DUA_XXX</ACTION>
    </ROW>
  </TABLE>
</RULE>

With this example, if the User-Agent value contains MSIE, GDCAX will be used (identified by DUA_GDC); otherwise the mapping that corresponds to the DUA_XXX will be used.