Back to Contents


Automatic Discovery of User Agent (adua.xrd)

adua.xrd is the configuration file used by the Application Server to determine which user agent is used. This file is stored in $FGLASDIR/as/etc.

Tip: Under most circumstances, modification of this file is not necessary.

Topics

Back to the top


Output Maps Overview

This section will document how Maps > Resources > Templates and template snippets.

Back to the top


How an Output Map is chosen

The Output Map used by an application is defined by the auda.xrd file, located in the $FGLASDIR/etc directory.

The Genero Application Server first identifies the value of the RULE element for the application. The RULE element is defined in the application configuration defined for and interpreted by the Genero Application Server.

For example, if the value of the RULE element is UseGWC, then drop into that element. Once inside that element, the type of device that is being used to display the application in the browser determines which Output Map is used to render the application.

<?xml version="1.0" encoding="UTF-8"?>
<?fjsRuleConfiguration Version="2.11"?>
<RULE_LIST
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://www.4js.com/ns/gas/2.11/xrd.xsd">
  <!-- Output Driver Determination (XRD - XML Rule Definition) -->
  <RULE Id="UseGDC">
    <TABLE Id="1" Key="User-Agent">
      <ROW>
        <IN>MSIE</IN>
        <ACTION Type="RESULT">DUA_GDC</ACTION>
      </ROW>
      <ROW>
        <IN>GDC</IN>
        <ACTION Type="RESULT">DUA_GDC</ACTION>
      </ROW>
    </TABLE>
  </RULE>
  <RULE Id="UseGJC">
    <TABLE Id="1" Key="User-Agent">
     <ROW>
       <ACTION Type="RESULT">DUA_GJC</ACTION>
     </ROW>
    </TABLE>
  </RULE>
  <RULE Id="UseGWC">
    <TABLE Id="1" Key="User-Agent">
      <ROW>
        <IN>Symbol-WC</IN>
        <ACTION Type="RESULT">DUA_Symbol-WC</ACTION>
      </ROW>
      <ROW>
        <IN>Symbian OS</IN>
        <ACTION Type="RESULT">DUA_PDA</ACTION>
      </ROW>
      <ROW>
        <IN>EPOC</IN>
        <ACTION Type="RESULT">DUA_PDA</ACTION>
      </ROW>
      <ROW>
        <IN>iPhone</IN>
        <ACTION Type="RESULT">DUA_PDA</ACTION>
      </ROW>
      <ROW>
        <IN>Windows CE</IN>
        <ACTION Type="RESULT">DUA_PDA</ACTION>
      </ROW>
      <ROW>
        <IN>PalmOS</IN>
        <ACTION Type="RESULT">DUA_PDA</ACTION>
      </ROW>
      <ROW>
        <IN>PalmSource</IN>
        <ACTION Type="RESULT">DUA_PDA</ACTION>
      </ROW>
      <ROW>
        <IN>Opera Mini</IN>
        <ACTION Type="RESULT">DUA_PDA</ACTION>
      </ROW>
      <ROW>
        <IN>MSIE</IN>
        <ACTION Type="RESULT">DUA_AJAX_HTML</ACTION>
      </ROW>
      <ROW>
        <ACTION Type="RESULT">DUA_AJAX</ACTION>
      </ROW>
    </TABLE>
  </RULE>
</RULE_LIST>

As shown in the sample auda.xrd file listed above, for handheld devices such as EPOC, iPhone, Windows CE, and PalmOS, the DUA_PDA Output Map is chosen. This Output Map consists of snippets that are designed to deliver an application on a handheld device. For other devices (such as desktop computers and standard laptops), the DUA_AJAX Output Map is selected.

Note: The built-in rendering engine remains for backwards compatibility and legacy implementations, however to use the built-in rendering engine you must either modify the auda.xrd file to specify "DUA_GWC" as the Output Map to use or explicitly reference the DUA_GWC Output Map in the application's URL. Both topics are covered below.

Back to the top


Modifying the auda.xrd file to specify custom Output Maps

If you have created a custom Output Map, you simply modify the Output Maps specified within the auda.xrd file to reference your new Output Map.

For example, imagine you have created an Output Map named DUA_AJAX1.

In the auda.xrd file installed by default, you would identify those situations where that application should use your custom Output Map. The decision is still based on the device on which the browser will display the application.

      ...
      <ROW>
        <ACTION Type="RESULT">DUA_AJAX1</ACTION>
      </ROW>
      ...

Back to the top


Specifying a specific Output Map in the application URI

You can specify an exact Output Map to use by including the Output Map declaration within the URL of the application.

For example, to specifically use the DUA_PDA Output Map when calling the Edit demo application, you would use the following URI:

	http://localhost:6394/wa/r/gwc-demo?OutputMap=DUA_PDA

You can force an application to use a specific Output Map by providing the Output Map as an argument in the application URL.

Example 1

   http://localhost:6394/wa/r/gwc-demo?OutputMap=DUA_GWC

In this example, the demo application is rendered using the DUA_GWC Output Map, which renders the application using the built-in rendering engine and its default theme.

Example 2

   http://localhost:6394/wa/r/gwc-demo?OutputMap=DUA_PDA

In this example, the demo application is rendered using the DUA_PDA Output Map, which renders the application using the snippet-based rendering engine and the PDA theme.

Back to the top


AUDA Syntax Diagrams

Syntax:

<RULE_LIST>
  <RULE Id="useId">
    <TABLE Id="numId" Key="keyType">
      <ROW>
        <IN>inType</IN>
        <OUT>outType</OUT>
        <ACTION Type="actionType">actionName</ACTION>
      </ROW>
      [<ROW> ...]
    </TABLE>
  </RULE>
  [<RULE> ...]
</RULE_LIST>

Example:

01 <RULE_LIST>
02   <RULE Id="UseGDC">
03     <TABLE Id="1" Key="User-Agent">
04       <ROW>
05         <IN>MSIE</IN>
06         <ACTION Type="RESULT">DUA_GDC</ACTION>
07       </ROW>
08       <ROW>
09         <IN>GDC</IN>
10         <ACTION Type="RESULT">DUA_GDC</ACTION>
11       </ROW>
12     </TABLE>
13    </RULE>
14    <RULE Id="UseGJC">
15     <TABLE Id="1" Key="User-Agent">
16       <ROW>
17         <ACTION Type="RESULT">DUA_GJC</ACTION>
18       </ROW>
19     </TABLE>
20    </RULE>
21 </RULE_LIST>

Note: A usage example is provided at the bottom of this section.

Back to the top


RULE_LIST

The RULE_LIST element is the main element of an XRD (XML Rule Definition) used by the Genero Application Server and contains the following child element:

  1. One or more RULE elements.

Back to the top


RULE

The RULE element defines a unique rule. The RULE element must specify an Id attribute; this required attribute takes a string value. The identifier (Id) of the rule defines its name, as it is going to be used later, in files such as the Genero Application Server configuration file. Valid values for the Id attribute include:

The RULE element contains the following child element:

  1. One or more TABLE elements. Each rule uses tables, which can be linked in order to have a complete process.

Back to the top


TABLE

The TABLE element must specify two attributes, an Id attribute and a Key attribute. 

The TABLE element contains the following child element:

  1. One or more ROW elements. Each table contains on or more rows. Rows are processed sequentially in order of appearance in the XRD file; therefore rows are not named.

Back to the top


ROW

The ROW element may contain the following child elements:

  1. Zero or more IN elements (optional). The IN element takes a string value, and specifies a string or sub-string that must be in the search string.
  2. Zero or more OUT elements (optional). The OUT element takes a string value, and specifies a string or sub-string that must not be in the search string (they must be OUT).
  3. One ACTION element (required). The ACTION element must specify a Type attribute and takes a required string (NMToken) value. If the string matches the IN and OUT rules (i.e., the IN and OUT conditions are met), this element defines the action to perform. Valid values for this element type are:

Back to the top


Usage Example

For this example, suppose you want to use GDCAX for Internet Explorer browsers and GJC for all other browser types. To achieve this, you have configure your application to support both Output Maps.

In your Genero Application Server configuration file (as.xcf), you would add a rule, such as UseAllOutputDriver shown below:

<APPLICATION Id="test" Parent="defaultwa">
  <EXECUTION>
    <PATH>$(res.path.fgldir.demo)</PATH>
    <MODULE>demo.42r</MODULE>
  </EXECUTION>
  <OUTPUT Rule="UseAllOutputDriver">
    <MAP Id="DUA_GJC" Allowed="TRUE">
      <RENDERING Using="cpn.rendering.wa"/>
      <THEME Using="cpn.theme.default.gjc"/>
    </MAP>
    <MAP Id="DUA_GDC" Allowed="TRUE">
      <RENDERING Using="cpn.rendering.wa"/>
      <THEME Using="cpn.theme.default.gdc"/>
    </MAP>
  </OUTPUT>
</APPLICATION>
In adua.xrd, you would have the following:
<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_GJC</ACTION>
    </ROW>
  </TABLE>
</RULE>
With this example, if the User-Agent value contains MSIE, GDCAX will be used; otherwise the GJC (java applet) will be used.

Back to the top