WebSTAR 4 Manual & Technical Reference

Manual Contents | Chapter Contents | Previous Page | Next Page

Suffix Mapping

WebSTAR uses CGIs and Plug-Ins for file listing, database access, multimedia, Server-Side-Includes, and other dynamic interactions. To launch most CGIs and Plug-Ins, the WebSTAR Web server uses special URLs (as specified by those add-on programs). When one of these the URLs is received, the server will examine the file name element and send the request to the appropriate CGI or Plug-In.

Entries in the Suffix Mapping Table define what should happen, based on the file name suffix, file creator or file type code. This could be processing by a CGI or Plug-In, or serving the file without any modification on the server side.

Each URL can only go through one Action, although Plug-Ins and CGIs can call others for additional processing.

Suffixes, Type and Creator Codes

The suffix is the element of the file name after the last period, as in these examples:

File Type and Creator Codes

Some files don't have special suffixes, or the suffix is not entered in the Actions . WebSTAR can also check files based on the File Type and Creator Codes . These are automatically generated by the application that creates a Mac file or converts it from another system. These codes control the icons on your desktop, and the automatic launching of the correct application when you double-click on a file.

To view these four-character codes, you need to use a resource editor, file code viewer such as the shareware FileTyper, or open Apple's Find File, select type or creator from the popup menu, and drag an example file to the window, which will display the code. For an example, see Handling a File With No Suffix .

How Suffix Mapping Works

1 A browser sends a URL to WebSTAR.
products/shipping.shtml
2 If there's a suffix at the end of the file part of the URL, looks up that suffix. WebSTAR uses the Action in the first matching entry.
For example, .shtml maps to the "SSI" Action, by default.
3 If there is no suffix, or no match for the suffix, the web server reads the Type and Creator code for the file that was requested and looks that up in the Suffix Map.
4 If none of these match, the web server will use the defaults: Action = Binary and default MIME Type (usually TEXT/HTML ).

Once the web server locates the correct entry, it either serves the file directly or sends the request to the Plug-In or CGI specified by the Action entry. For more information, see Suffix Mapping Example: Using SSI for All HTML Files .

Examples of Suffix Mapping

Handling a GIF File

Suppose our server receives this URL:

 
http://www.domain.com/logo.gif

The WebSTAR Web server looks up .gif in the Suffix Mapping Table. It finds only one entry with a suffix that matches, which has the Action of BINARY .

So the server locates the logo.gif file in the root folder, reads the data and returns it to the browser with the " image/gif " MIME type, and without any further processing. Most browsers will display images of this type directly in the browser window.

For information, see MIME Type

Handling an Image Map

If a server gets a URL like this (and has the WebSTAR Image Map Plug-In installed):

 
http://www.domain.com/logo.map

it first looks up .map in the Suffix Mapping Table, where it finds the first entry matching that suffix. Because the Action is IMAGE_MAP , the web server passes the appropriate data to the WebSTAR Image Map Plug-In, which processes the request and sends back a result. Then the server returns the resulting data to the browser with the MIME type application/x-image-map .

See also WebSTAR Image Map .

Handling a File With No Suffix

Here's an example without a suffix, to show how the Type and Creator code matching works. If this server got a request with this URL:

 
http://www.domain.com/MyStuffedFile

it would look into the Suffix Mapping Table. Because is no suffix, WebSTAR has to locate the file MyStuffedFile , and get the file Type and Creator codes. In this case, the web server will look in the Suffix Map for a file with a Creator of " SITD " and a File code of " SIT! ".

 

It finds one match (in our example), and returns the file with a special MIME type of application/x-stuffit . This tells the browser to use the helper application defined for this MIME type, which should launch StuffIt or StuffIt Expander and open this compressed file. Note that this entry will only match files created with StuffIt. To match all compressed files in this format, you could put an asterisk in the Creator field.

Editing Suffix Mapping Table Entries

The Suffix Mapping Table displays the WebSTAR Web server's current mapping, action and MIME type entries. You can rearrange and edit these entries, or add new entries as you add third-party Plug-Ins to WebSTAR. It's wise to write down a list of your suffix mapping changes, or take screenshots, in case you ever need to re-create them.

Many third-party Plug-Ins automatically install Suffix Mapping entries in this table. Consult their documentation for details.

The pre-defined entries in the suffix mapping table, cover text, graphics, CGIs, encoding and compression, common application files, multimedia and Java. For descriptions, see Suffix Mapping Defaults .

Type and Creator Code fields which include a space as part of the four-letter code must be encoded when you enter them as part of the Suffix Map. For example, enter the code ` PDF ' as PDF%20 .

WebSTAR Admin Suffix Mapping Table

Choose the Suffix Mapping item in the WebSTAR Admin Settings window to open the Suffix Mapping Table. Each entry has a line in this table, and includes over 35 of the most common suffixes already. These defaults are listed in Suffix Mapping Defaults .

 

The entries for WebSTAR Plug-Ins are at the top of the list, marked as locked (·). You cannot change or delete these entries. You can change any other entry, and add your own.

Changes in the Suffix Mapping Table are stored in the WebSTAR Settings file.

To make a new Suffix Mapping entry, decide where you want it to be in the list. WebSTAR will use the first entry it can find (see How Suffix Mapping Works ). Then select the entry before the new entry, and click the New button.

For more instructions, see Working With Admin Lists .

Browser Admin Suffix Mapping Table

The WebSTAR Browser Admin pages also allow you to work with the Suffix Mapping Table. Go to the Administration main page, and choose Settings > Suffix-Mappings.

To make a new Suffix Mapping entry, decide where you want it to be in the list. WebSTAR will use the first entry it can find (see How Suffix Mapping Works ). Look at the Order Number for the entry before your preferred location, and type a new Order number after that number, but before the following number (for example, to add a new entry after .GIF but before .HTML , you'd enter the order number 1650 . Follow the instructions below to fill the fields and choose the Action. Then click the Add New Entry Button.

To edit a Suffix Mapping entry, click on the Select radio button for that entry, and then click the Edit Selection button. When you're done with your changes, click the Replace Selection button, and your changes will be saved.

To move an entry, type a new Order number in the Order field, and click the Reorder button. For example, to move .MIDI above .MOV , type 2150 in the .MIDI Order field and click Reorder .

To delete an entry, click on the Select radio button for that field and click the Delete Selection button.

Fields in the Suffix Mapping Table

The Suffix Mapping table has six fields. The Suffix, Type and Creator fields help WebSTAR identify a URL, the Action field defines how the URL should be handled, and the MIME Type field specifies the type of information being returned to the browser.

Locked

The locked column on the left includes a bullet (·) for those entries which cannot be edited, such as those used by Plug-Ins.

Action Popup Menu

The Action field tells the WebSTAR server what to do with this kind of URL. The Suffix Mapping interfaces include the available Actions in the popup menu. Several of them are extremely useful, while others are for internal use only.

For an example RAW file, see Redirect Files .

Useful Plug-In Actions

For Internal Use

Other actions are registered by WebSTAR Plug-Ins, and are used mainly by them. If a third-party Plug-In uses these Actions, it should instruct you what change to make in your Suffix Mapping Table.

For information about these Plug-Ins, see their sections in WebSTAR Plug-Ins .

Adding Actions to the Menu

Some Plug-Ins add actions to the Actions list automatically. You can also define actions to be included on this menu, as described in Actions .

Match Fields: File Suffix, Type and Creator

The web server uses these fields to locate the correct entry in this table. For a description of this mapping process, see How Suffix Mapping Works .

To make a match field match anything, enter an asterisk (*). Blank fields will only match empty strings: a blank suffix field will match file URLs with no suffix at all.

All Mac files have a type and creator code, so if you use this feature, use asterisks and do not leave any field blank.

To make a entry match all files created by a particular program, such as all files compressed by StuffIt, enter the Creator code ( SITD ) and an asterisk in the Type field. Likewise, to handle all files of a particular kind (such as QuickTime movies), you can enter an asterisk in the Creator field and the code in the Type field (in this case, MOOV ).

Be sure to consider the order: WebSTAR uses the first suffix match, the first Type and Creator match, the first Type match and finally, the first Creator match.

MIME Type

The MIME Type appears in the form "general/specific". These can be defined by the web community, like text/html or a vendor such as Apple, with video/quicktime . Your server can also send files to be opened by a specific application, when the MIME type is "application" and the program name. For example, you can specify application/pdf for Adobe Acrobat files or application/x-pn-realaudio for RealAudio files.

Some third-party CGIs and Plug-Ins use the MIME types for their own internal purposes as well. Check their documentation for information.

There's no definitive list of MIME types on the Web, but a useful listing is available at:

http://www.isi.edu/in-notes/iana/assignments/media-types/media-types

In addition, publishers of software that requires special MIME types may have describe them in their documentation or web site, or the information may be available through Usenet newsgroups or email discussion lists on the software. If the software includes a browser Plug-In, you can install it and then view the browser's application settings to discover the MIME type.

The WebSTAR Default MIME Type is text/html : you can reset this in the WebSTAR Admin File Names panel, as described in Default MIME Type .

Suffix Mapping Example: Using SSI for All HTML Files

Perhaps you'd like to include the modification date or other Server-Side Include feature in your pages, but you don't want to change the suffix from .html . You can use the Suffix Mapping Table to instruct the web server to use the WebSTAR SSI Plug-In for all .html files.

See also WebSTAR SSI .

The steps are:

1 In the WebSTAR Admin application, connect to the server, and open the Server Settings window, then select Suffix Mapping.
2 Select the entry for .HTML
 
3 Select the Action popup menu and choose SSI:
 
The entry will update in the table.
4 Click Save to send the change back to your WebSTAR server.

From now on, all HTML files will be sent through SSI before they are returned to the browser. WebSTAR SSI will replace the SSI commands in the file with the appropriate data (such as the date the file was changed), and the browser will display these as standard text.


Manual Contents | Chapter Contents | Previous Page | Next Page