One service made available by DynamoHttpServletRequest is the BrowserTyper. The BrowserTyper service enables Dynamo to identify a visitor’s Web browser type and group it into one or more categories. This service (a component of class atg.servlet.BrowserTyper) identifies browsers by the user-agent header field in the request. The BrowserTyper manages a list of browser types, each of which has a name that identifies the browser and a list of patterns that the BrowserTyper uses for matching user-agent fields to browser types.

The list of browser types is found in /atg/dynamo/servlet/pipeline/BrowserTypes. It includes all commonly used browsers, and groups them according to several different attributes, including, among others:

Each browser type is defined as a component in the /atg/dynamo/servlet/pipeline/BrowserTypes directory. These components include two properties: the name of the browser type and the patterns in the user-agent header by which the BrowserTyper attempts to recognize the browser type.

You can add to the list of browser types that the BrowserTyper can recognize. To do this:

  1. Add the names of your browser types to the browserTypes property of the BrowserTyper component in /atg/dynamo/servlet/pipeline, like this:


  2. Create an atg.servlet.BrowserType class component in the /atg/dynamo/servlet/pipeline/BrowserTypes directory for each additional browser type.

  3. The .properties file of the BrowserType component should look like this:



  4. The patterns property is a list of simplified regular expressions that are matched against the user-agent header for the request. If any of them match, the isBrowserType() method of atg.servlet.BrowserTyper returns true.

  5. The simplified regular expression string has the following form:

    <regexps> = empty |
         <regexps> <regexp>

    <regexp> =
         <base type>
         <type set>

    <base type> =
         any character other than:
           * + ? | ( ) [ ] .

    <type set> =
         [<base types>]

    <base types> = empty |
         <base types> <base type>

    '*' 0 or more times
    '+' 1 or more times
    '?' 0 or 1 time
    '.' Matches any character except \n
    '|' Separates alternatives, e.g. [a | b | c] is 'a or b or c'
    [ ] Join multiple expressions into one expression
    ( ) Group expressions

Browser Caching of Dynamic Pages

Some browsers handle page caching in a way that conflicts with dynamic page requests. Dynamo’s browser typer marks page requests from those browsers as non-cacheable to override the aggressive caching behavior of some browsers and proxy servers. Because Dynamo does not set a Lastmodified header for JSP requests, browsers should not cache results. However, some browsers (such as Microsoft IE 5.0) do cache these pages. Thus, these browsers might display stale content to users on your site. This occurs because of bad caching: instead of re-requesting the JSP, the browser incorrectly displays the cached version. In addition to showing potentially stale content, URL-based session tracking breaks with these browsers.

To prevent browsers from caching dynamic pages, Dynamo sends headers to these browsers with the following:

Pragma: no-cache

This behavior is controlled with a special Dynamo browser type called badcacher defined by the following component:


This component has a patterns property that defines a regular expression that matches the useragent header sent by the browser. If the useragent matches, the Pragma: nocache and Expires: date-in-the-past headers are sent with each request. By default, Microsoft IE 5.0 is listed as one of these browsers. You can control the list of useragents where caching is disabled by editing the values of the BadCacher component’s patterns property.

BrowserAttributes Component

Dynamo includes a request-scoped component at /atg/dynamo/servlet/pipeline/BrowserAttributes that exposes all the known BrowserTyper characteristics of the current request as boolean properties.

This component enables you to create JSPs that display different features, depending on properties like the browser type, so you can include browser-specific or feature-specific code in your pages without resorting to embedded Java tags to test the browser type.

The following example tests whether the request comes from an Internet Explorer browser:

<dsp:droplet name="/atg/dynamo/droplet/Switch">
  <dsp:param bean="BrowserAttributes.MSIE" name="value"/>
  <dsp:oparam name="true">
    Hmmm... you seem to be using Internet Explorer.
  <dsp:oparam name="false">
    You aren't using Internet Explorer.
loading table of contents...