[ Previous ] [ Contents ] [ Index ] [ Next ]

Configuring ADP Processing

Since you will be creating HTML pages that contain Tcl scripts, you will need to specify which pages the server will need to parse for Tcl commands and process.

Required Configuration Parameters

Advanced (Optional) Configuration Parameters:

Enabling ADPs

The following table describes the parameters that can be set within the ADP section of the configuration file:

[ns/server/server-name/adp]

Parameter

Default Value

Description

Map

The Map parameter specifies which pages the server will parse. You can specify a file extension (such as /*.adp) or a directory (such as /usr/pages/adp). If no directory is specified, the pages directory is assumed. The wildcards * ? and [] can be included in the Map specification. You can specify multiple Map settings.

The following example specifies that all files in the pages directory with the extensions .adp or .dci will be parsed, and all files in the /usr/pages/myadps directory will be parsed.

    Map=/*.adp
    Map=/*.asp
    Map=/usr/pages/myadps

GlobalInclude

Off

Boolean value. Set to On to specify that Tcl in ADPs run with ns_adp_parse or ns_adp_include will be evaluated at the global level. If this parameter is Off, Tcl in ADPs will be evaluated locally.

HideSource

On

Boolean value. Set to On to restrict users from viewing the source of the Tcl script in browsers that allow HTML source to be viewed. If the HTTP client sends an Accept header containing text/x-server-parsed-html, the source of the file is returned. AOLpress sends this header if you view the HTML source (by clicking on the Show HTML icon or choosing "Show HTML" from the Tools menu) and then choose "Reload Without SSI" from the File menu.

If this parameter is Off, you can view the Tcl script source in AOLpress as described above.

If this parameter is On, only the HTML resulting from the Tcl script will be shown when a user views the HTML source for a page.

IgnoreErrors

On

Boolean value. If set to Off, and an error occurs while evaluating an ADP, an error page will be returned and the remainder of the ADP will not be evaluated.

If set to On, errors in ADPs will be ignored and the ADP will continue processing.

MaxCallDepth

256

The maximum number of nested ADP evaluations. Nested ADP evaluations, such as recursive ns_adp_include calls (where an ADP includes itself), can often lead to crashes

The ns_adp_include and ns_adp_parse Tcl functions, and the Ns_AdpParseFile and Ns_AdpParseFp and  Ns_AdpParseBuffer C functions, return an error if this limit is exceeded.

Debugging ADPs

The ClientDebug parameter lets you specify IP addresses to be enabled for debugging of ADPs. Alternatively, you can turn on client debugging temporarily from the /NS/Tcl/Admin pages.

[ns/server/server-name/tcl]

Parameter

Default Value

Description

ClientDebug

Specify an IP address to be enabled for ADP debugging. If an IP address is specified with this parameter, error backtraces resulting from running an embedded Tcl script are inserted into the page. You can have multiple ClientDebug entries to specify multiple addresses. For example:

    ClientDebug=111.222.333.444
    ClientDebug=111.222.333.445

Caching ADPs

AOLserver allows caching of dynamic content. Because of the overhead involved in server-side processing of ADPs, it is extremely beneficial to minimize the number of times each page must be read from disk and parsed. By saving parsed ADPs in memory, caching allows dynamic content to be served more efficiently. Note that ADPs are parsed when they are cached, but they are not evaluated. Parsed ADPs are stored in the cache, identified by the name of the ADP. When an ADP is invoked, it is evaluated from the parsed version in the cache (if it exists) with the arguments passed to it.

If ADP caching is enabled, there will be a Cache Administration link on the /NS/Admin page of the server. You can follow the link to get to the Cache Administration page, which will allow you to empty the ADP cache.

By default, ADPs are not cached. To enable caching, you need to load the nscache.so module and turn on the CacheADP configuration parameter. There are several other configuration parameters you can set to customize caching for a server. All of the configuration parameters for caching are described in the following tables.

[ns/server/server-name/modules]

Parameter

Default Value

Description

nscache

nscache.so

If present, caching of ADPs can be enabled.

[ns/server/server-name/module/nscache]

Parameter

Default Value

Description

CacheADP

Off

Boolean value. If set to On, ADP caching is enabled.

[ns/server/server-name/module/nscache/adp]

Parameter

Default Value

Description

DefaultExpires

60

The number of seconds after which a cache entry will automatically expire and be removed from the cache. The ADP cache uses any Expires headers that are set when the ADP is served to determine when ADPs should expire from the cache. The DefaultExpires time is only used if no Expires header is set explicity by the ADP.

You can also use the ns_setexpires Tcl function to set the Expires header.

DoStat

On

Boolean value. If set to On, a "stat" call is performed for each request, and the cache will detect when files have changed on disk and update them in the cache. There is a slight performance penalty in this case.

If set to Off, files are not checked on every request. Files are updated in the cache only when they expire naturally.

MaxEntry

0

The maximum size, in kilobytes, for any single cache entry. Setting this parameter to 0 means that there is no limit to the size of a cache entry. Set this parameter to a value greater than 0 to prevent a single large file from using up too much of the cache.

MaxExpires

10800

The maximum number of seconds after which cache entries will be forced to expire, even if a higher value was set in the Expires header during processing. The default value, 10800, is equivalent to 3 hours.

MaxSize

0

The maximum size, in kilobytes, of the cache. Setting this parameter to 0 means that there is no limit on the size of the cache.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.