Share via


Defining content-type parsers in responses for HAT configuration in IAG

Applies To: Intelligent Application Gateway (IAG)

When configure host access translation (HAT) properties in Whale Communications Intelligent Application Gateway (IAG) 2007, you can configure additional tags that will be parsed by the content-type parsers in responses. By default, the content-type parsers are configured so that all tags that can contain links are parsed during data manipulation. This topic describes how to configure tags for the HTML and JavaScript parsers. For more information about HAT, see About host address translation (HAT) in IAG portals.

Configuring the HTML parser

In IAG the HTML parser is used in responses only. It is defined in the Application Access Portal configuration file in the element <PARSER_HTML>, described below.

<PARSER_HTML>

Description

Defines all the HTML tags and event handlers that are parsed; the links that are found within those tags and event handlers are manipulated, as described in Host Address Translation. By default, the parser is configured to parse all standard tags and event handlers that contain links. You can edit the file to add other non-standard tags or event handlers, which might contain links in your application.

Usage

Only one <PARSER_HTML> element must reside in the AAP configuration file.

Attributes & Attribute Values

None.

Child Elements

  • <PARSER_HTML> can contain one <EVENT_HANDLERS> element.

  • <PARSER_HTML> can contain an unlimited number of <TAG> elements.

[<PARSER_HTML>] > [<EVENT_HANDLERS>]

<EVENT_HANDLERS>

Description

Child element of <PARSER_HTML>. Defines HTML and DHTML event handlers that will be parsed. The event handlers are associated with the HTML tags via tag attributes. When an event handler is configured to be parsed, it is parsed in all the tags that the parser handles (defined in the <TAG> elements).

  • For each event handler, you can configure a list of “exclude” tags, in which the handler will not be parsed.

  • In order to parse an event handler only in a selected tag (or tags), define it as part of the tag definition, in an <ATTR> element.

Usage

  • Optional

  • One <EVENT_HANDLERS> element can reside under <PARSER_HTML>.

Attributes & Attribute Values

None.

Child Elements

<EVENT_HANDLERS> can contain an unlimited number of <HANDLER> elements, described below.

[<PARSER_HTML>] > [<EVENT_HANDLERS>] > [<HANDLER>]

<HANDLER>

Description

Child element of <EVENT_HANDLERS>. Defines the HTML or DHTML event handler that will be parsed.

Usage

An unlimited number of <HANDLER> elements can be nested under <EVENT_HANDLERS>.

Attributes & Attribute Values

Attribute Values Type or comments

parser

PARSER_EXCEPTION

PARSER_SAR

Mandatory. Defines the parser that will parse the script within the event handler:

  • PARSER_EXCEPTION: parses JavaScript

  • PARSER_SAR: parses absolute URLs

Child Elements

  • <HANDLER> must contain one <NAME> element, described below.

  • <HANDLER> can contain an unlimited number of <EXCLUDE> elements.

[<PARSER_HTML>] > [<EVENT_HANDLERS>] > [<HANDLER>] > [<NAME>]

<NAME>

Description

Child element of <HANDLER>. Defines the name of the event handler that will be parsed.

Usage

Only one <NAME> element must be nested under each <HANDLER> element.

Attributes & Attribute Values

None.

Child Elements

None.

[<PARSER_HTML>] > [<EVENT_HANDLERS>] > [<HANDLER>] > [<EXCLUDE>]

<EXCLUDE>

Description

Child element of <HANDLER>. Defines an HTML tag in which the event handler, defined in <NAME>, will not be parsed.

Usage

  • <EXCLUDE> is optional.

  • An unlimited number of <EXCLUDE> elements can be nested under each <HANDLER> element.

Attributes & Attribute Values

None.

Child Elements

None.

[<PARSER_HTML>] > [<TAG>]

<TAG>

Description

Child element of <PARSER_HTML>. Defines the tag that will be parsed.

Usage

  • At least one <TAG> element must reside under <PARSER_HTML>.

  • An unlimited number of <TAG> elements can reside under <PARSER_HTML>.

Attributes & Attribute Values

Attribute Values Type or comments

replace_att

true, false

Optional. Searches for and manipulates links inside the defined tag attributes.

sar

true, false

Optional. Searches for and manipulates links in the entire tag.

tag_delimiter

Delimiter of the tag defined in the <NAME> child element.

Optional. Must be used if sar=true.

Examples:

  • The delimiter of the tag <SCRIPT> is </SCRIPT>

  • The delimiter of the tag <META is >

Note

In each <TAG>, at least one of the following attributes must have a true value:

replace_att

sar

In each <TAG>, both attributes can be true.

Child Elements

  • <TAG> must contain one <NAME> element, described below.

  • <TAG> can contain only one <NAME> element.

  • When replace_att=true, <TAG> must contain at least one <ATTR> element.

  • When replace_att=true, <TAG> can contain an unlimited number of <ATTR> elements.

[<PARSER_HTML>] > [<TAG>] > [<NAME>]

<NAME>

Description

Child element of <TAG>. Defines the name of the tag to be parsed.

Usage

Only one <NAME> element must reside under <TAG>.

Attributes & Attribute Values

None.

Child Elements

None.

[<PARSER_HTML>] > [<TAG>] > [<ATTR>]

<ATTR>

Description

Child element of <TAG>. Used only when, in the definition of <TAG>, replace_att=true. Defines the attribute that will be parsed within the tag defined in <NAME>.

Usage

  • If, in the definition of <TAG>, replace_att=true, one <ATTR> element must reside under <TAG>.

  • If, in the definition of <TAG>, replace_att=true, an unlimited number of <ATTR> elements can reside under <TAG>.

Attributes & Attribute Values

None.

Child Elements

None.

Sample Code: <PARSER_HTML>

<PARSER_HTML>

<!--This tag holds the configuration of the html parser.

For each tag there are three actions:

1. Event handlers that contain JavaScript executable code.

2. replace_attr (in which the attr to replace should be

specified)

3. sar (in which case the delimiter of the tag should be

specified)

<EVENT_HANDLERS>

<!-- Each event handler can have an exclude list of all

the HTML tags in which the event handler will not be

parsed. In the following example, the OnClick

handler will not be parsed by the HTML parser when

it appears in the tag a:

<HANDLER parser="PARSER_JAVASCRIPT">

<NAME>OnClick</NAME>

<EXCLUDE>a</EXCLUDE>

</HANDLER>

-->

<!-- HTML event handlers -->

<HANDLER parser="PARSER_JAVASCRIPT">

<NAME>OnClick</NAME>

</HANDLER>

<HANDLER parser="PARSER_JAVASCRIPT">

<NAME>OnDblClick</NAME>

</HANDLER>

<HANDLER parser="PARSER_JAVASCRIPT">

<NAME>OnMouseDown</NAME>

</HANDLER>

<!-- DHTML event handlers -->

<HANDLER parser="PARSER_JAVASCRIPT">

<NAME>OnBounce</NAME>

</HANDLER>

<HANDLER parser="PARSER_JAVASCRIPT">

<NAME>OnScroll</NAME>

</HANDLER>

</EVENT_HANDLERS>

<!--

==========================================================

==========================================================

TAGS which have a list of replaceable attributes

==========================================================

==========================================================

-->

<TAG replace_attr="true" sar="false" tag_delimiter="">

<NAME>a</NAME>

<ATTR>href</ATTR>

</TAG>

<TAG replace_attr="true" sar="false" tag_delimiter="">

<NAME>area</NAME>

<ATTR>href</ATTR>

</TAG>

<TAG replace_attr="true" sar="false" tag_delimiter="">

<NAME>base</NAME>

<ATTR>href</ATTR>

</TAG>

<TAG replace_attr="true" sar="false" tag_delimiter="">

<NAME>blockquote</NAME>

<ATTR>cite</ATTR>

</TAG>

<TAG replace_attr="true" sar="false" tag_delimiter="">

<NAME>body</NAME>

<ATTR>background</ATTR>

</TAG>

<TAG replace_attr="true" sar="false" tag_delimiter="">

<NAME>button</NAME>

</TAG>

<TAG replace_attr="true" sar="false" tag_delimiter="">

<NAME>del</NAME>

<ATTR>cite</ATTR>

</TAG>

<TAG replace_attr="true" sar="false" tag_delimiter="">

<NAME>embed</NAME>

<ATTR>pluginspage</ATTR>

<ATTR>src</ATTR>

</TAG>

</PARSER_HTML>

Configuring the JavaScript parser

The JavaScript parser is only used in responses. It is defined in the AAP configuration file in the element <PARSER_EXCEPTION>, described below.

Tip

When you configure the manipulation of a tag in the parser, the parser searches for the tag in all responses. If you wish to apply the manipulation to a limited number of URLs, you can apply token-to-token replacement to the specific URLs, thus enhancing system performance.

<PARSER_EXCEPTION>

Description

Defines all the JavaScript commands that are parsed; the links that are found within those commands are manipulated. By default, the parser is configured to parse all standard commands that contain links. You can edit the file in order to add other non-standard commands, which might contain links in your application.

Usage

Only one <PARSER_EXCEPTION> element must reside in the AAP configuration file.

Attributes & Attribute Values

None.

Child Elements

  • <PARSER_EXCEPTION> must contain at least one <SEARCH> element.

  • <PARSER_EXCEPTION> can contain an unlimited number of <SEARCH> elements.

Description

Child element of <PARSER_EXCEPTION>. Defines the command to be parsed and the command’s operation character.

Usage

  • At least one <SEARCH> element must be nested under <PARSER_EXCEPTION>.

  • An unlimited number of <SEARCH> elements can be nested under <PARSER_EXCEPTION>.

Attributes & Attribute Values

Attribute Values Type or comments

opr_char

(

-

Mandatory. Defines the operation character: function opening or implementation, respectively.

encoding

base64

Optional.

Child Elements

None.

Sample Code

The following sample configures the JavaScript parser to search for links in the command openNewWindow, with the following attributes:

  • The command character is directly followed by an opening parenthesis; therefore, the operation character is (.

  • Encoding is not used.

<SEARCH start="(" encoding="">openNewWindow</SEARCH>

Sample Code: <PARSER_EXCEPTION>

<PARSER_EXCEPTION>

<!-- This TAG holds Java Script configuration -->

<SEARCH opr_char="(" encoding="">openNewWindow</SEARCH>

<SEARCH opr_char="(" encoding="">openInnewWindow</SEARCH>

<SEARCH opr_char="(" encoding="">openWin</SEARCH>

<SEARCH opr_char="(" encoding="">open</SEARCH>

<SEARCH opr_char="(" encoding="">load</SEARCH>

<SEARCH opr_char="(" encoding="">url</SEARCH>

<SEARCH opr_char="(" encoding="">location.replace</SEARCH>

<SEARCH opr_char="=" encoding="">href</SEARCH>

<SEARCH opr_char="=" encoding="">location</SEARCH>

<SEARCH opr_char="=" encoding="">location.href</SEARCH>

<SEARCH opr_char="=" encoding="">selecter1.action</SEARCH>

<SEARCH opr_char="=" encoding="">url</SEARCH>

<SEARCH opr_char="=" encoding="">pathname</SEARCH>

<SEARCH opr_char="=" encoding="">src</SEARCH>

<SEARCH opr_char="=" encoding="">lowsrc</SEARCH>

</PARSER_EXCEPTION>