Dynamic Indexing

The term "directory" throughout this section refers to any of the following:

IFS and QDLS File System
a directory containing subdirectories and files
QSYS file system
a library containing files, or a file containing members
QSYS library
the QSYS library is a special library, it is the only library that can contain other libraries as well as files.

Dynamic Indexing

The Dynamic Indexing feature of Web Server/400 provides an index of a directory. This index is provided by a dynamically built HTML document which includes a hyper-link to each of the index items. The hyper-links to other directories within the index will result in a dynamic index of the directory chosen. This is a convenient way to traverse through directories.

Since this index is built dynamically, any changes made within the directory will be incorporated the next time the index is requested. A good example of this is a view of research papers documented using the HTML markup language submitted through an FTP site. The directory access for viewing the documents could be Web Server/400, while the transfer mechanism of providing and maintaining the documents could be an FTP or Gopher server accessing the same directory.

Disabling Dynamic Indexing

There are two different methods to disable the dynamic indexing feature. If you prefer to disable this feature completely for all directories, configure the Index Default View parameter to do so. If you prefer to disable the dynamic indexing feature only for a particular directory include the index name file within that directory. Any directories which contain the index name file within a directory will display the index name file in place of the dynamic index view.

The use of a symbolic link for the index name file would be an efficient way to disable the dynamic index view of a directory. The symbolic link would allow the WebMaster to give the main file a name which better describes the files' purpose other than the generic name normally specified for the index name file. By using a symbolic link when you change the main file the symbolic link will automatically reflect the changes without having to perform dual maintenance on the files. The same file will be resolved regardless of whether the URL contains the descriptive name, or just ending in a '/' after the directory name is specified.

Features of Dynamic Indexing

Header and Footer Files

The dynamic indexing feature supports the ability to include the contents of an HTML marked up file or the contents of a plain text file at the head and foot of each directory. These files will be referred to as the header and footer. Neither are required and one is allowed without the other.

If the header is resolved with the content type of text/html, then it is assumed that the header file will include all the appropriate HTML markup tags up to and including the <BODY> tag. It is also assumed that if there is a text/html header that there is a footer which will appropriately end the HTML tags started by the header. In this case the server will not add any HTML tags other than those necessary for the actual index list.

If the header is not resolved or is considered not to be text/html then the server will include the following sets of tags:

If the header or footer is resolved with a content type other than text/html the server will wrap the contents of the file with preformatted text tags (<PRE> and </PRE>).

Excluding Files

Included with the dynamic indexing feature is the support to exclude files from the index list. This can be accomplished through configuration. The configuration allows the WebMaster to specify multiple file names to be excluded from the index list that is returned to the user. The list of file names supports the use of the '*' and '?' wildcard characters. The list of file names is case insensitive in all file systems (including QOpenSys which is a case sensitive file system). By default, the default header and footer files will be excluded from index lists.

Send Directory Content Length

Dynamic Indexing has a configuration option, Send Directory Content Length, which specifies whether the content length will be sent back to the browser for dynamic indexing requests. If the content length is not sent back to the browser, the browser will be unable to determine how much of the response data is left to be received. However, especially for large directories, the performance when the content length is not sent back will be better than if it is requested to be returned in the response header. The reason for this performance gain is that since the directory index is built dynamically, the size of the output is not known until the entire output has been built. Since the content length is part of the response header which is sent back prior to the index data, the entire output will be held back until the content length is calculated.

Enhanced and Simple Views

There are two different views available for the dynamic index:

Simple view.
The simple view of a directory would include a sorted list of the file names and subdirectories displayed as hyper-links to those files or subdirectories. The view is created using the unordered list HTML tags.
Enhanced view
The enhanced view of a directory would include a sorted list of the file names and subdirectories displayed as hyper-links to those files or subdirectories. The view is created as a table like view through the use of preformatted text HTML tags. The table will include additional pieces of information not available in the simple view. The WebMaster can control how much additional information will be included.

There are a number of configurable values associated with the views of the dynamic index. The first value allows you to determine which view is the default view. The default view can be configured to be Simple, Enhanced, or Disabled all together. The simple view is a basic list of the index (sorted by file name). The enhanced view includes additional information for each entry. The amount and type of additional information available with the enhanced view (Index Style) is configurable by the WebMaster. Generally speaking, the Enhanced view of a directory index takes longer to provide than a Simple view since more information is gathered and sent to the browser.

Both the simple and enhanced views have the option to include a statement with a hyper-link at the top of each index allowing the user to choose to see the other view. For example, at the top of a directory's simple view, the statement referring to the enhanced view of this index (including a hyper-link) would be available. If the WebMaster did not choose to show this statement it can be disabled through the default view configuration. An example of where this hyper-link would be useful is when the WebMaster chooses the simple view of directories as the default, (most likely to enhance the speed of the dynamic index). If the user would like to view the size of the files prior to requesting to view them, the user may click on the enhanced view for the additional information available.

The keywords included within a Dynamic Indexing URL which override the view of a directory are always available when Dynamic Indexing is allowed. The keywords are

The simple view of dynamic directory.
This URL would display the simple view of the DocumentRoot/samples/index/ directory.
The enhanced view of dynamic directory.
This URL would display the enhanced view of the DocumentRoot/samples/index/ directory.

Enhanced View Detailed Information

Including Icons
One of the additional pieces of information available in the enhanced view is an icon. The WebMaster can configure the enhanced view to include an icon for each index item. In addition to including the icon, the WebMaster can specify whether the icon will include a hyper-link (MakeIconsLinks) to the indexed item as well as the hyper-link on the index item name.

There are six different options available for icon selection index items, all of which are configurable.

Including File Descriptions

The enhanced view of the index allows the WebMaster to configure descriptions to be displayed for each file within the index. There are multiple locations where the descriptions may be extracted from. These locations vary depending upon the type of file in the index, and the file system where the dynamic index is being retrieved from.

If the WebMaster has configured the server to include HTML TITLES when a file's content type resolves to text/html, the TITLE found within the text/html file will be searched for first. If the file's content type does not resolve to text/html or a TITLE is not found within the file, the Global Access configuration file will be searched for a description matching the file name. The HTML TITLES and Access Control file descriptions are available for all files residing in all file systems.

In the QSYS file system there is one additional location where the description will be searched for if it is not already found. When displaying the dynamic index of a library, the OS/400 Object's text description will be used. When displaying the dynamic index of a file within the QSYS file system, the member's text description within the file will be displayed.

There is a limit to the number of bytes that the Web Server/400 product will search for a description when the include HTML TITLES option has been configured. The limit is file system dependent. Within the ROOT and QDLS file systems the first 512 bytes must contain the HTML keywords and in order for the TITLE to be used as the description. Within the QSYS file system 1024 bytes will be searched.

Note: including the HTML title as the description could degrade the server's performance. Including the HTML title as the description requires that each file included within the dynamic index, which has a text/html content type, to be opened, read and the file's contents searched through for the HTML TITLE. Directories with a large number of HTML files potentially require significant additional processing.

Including Date and Time
The enhanced view of the dynamic index provides the ability for the WebMaster to configure the server to query and return the last date and time the file was modified. The last modified date is available without the time value however, the last modified time is not available without the date information.
Including File Size
The enhanced view of the dynamic index provides the ability for the WebMaster to configure the server to query and return the size of the file. This can be useful to the user if they want to determine how big a file is prior to viewing it.


Shipped with the Web Server/400 product are some sample directories set up to demonstrate the dynamic indexing feature.