W2H: How to configure a specialized viewer


Each file (document) coming to Netscape from the http server has an associated MIME type which is responsible for what Netscape does with the file. The file can get this MIME type from two places:
  1. Files coming from ftp and local disks (those starting with ftp://... and file:/...) come without any header so it is up to Netscape to decide what type of file they are. This is done using the .mailcap and .mime.types files on the client side.

  2. Files coming from a http server (those starting with http://....) are "cleverer" because the http server has also a database of MIME-types and normally provides a MIME type to any sending document. In this case Netscape doesn't need to deduce a MIME type by a file extension, but only looks into its .mailcap what application (viewer) to start.

How does it work in the W2H interface? All files to be viewed are sent to a script which has always the same name nph-w2h.vievfile (it is a different story why it is done like this). Therefore, this script itself must find a reasonable MIME type for a given file and send it back with a file (the server has no change to determine it by a file name). The script uses the server's MIME type database for this purpose. If no good MIME type is found the script sends back default 'text/plain' resulting in a simple text display (reasonable for sequence files etc).

Thus if you plan to give your users a specialized viewer (for example for viewing the .figure files), you must change a server MIME type file, not only the client files. Usually, the file is /usr/local/etc/httpd/conf/mime.types but it can vary depending on which server you use. In the W2H configuration file Cfg.pl file (see installation step-by-step), the variable $SERVER_ROOT should point to a directory with this file.

Even if you are not trying to introduce a new viewer you should check if this variable is properly set. Because if not then no viewers are started at all (a postcript viewer for example).

In case you do not get expected results you may try the following simple test to be sure what is returned from your http server:

  1. Copy the file you want to view to the place accesible by your httpd server (for example usuallly /usr/local/etc/htdocs).

  2. telnet your-server-name 80

    Note that 80 is a port number, maybe you have different one.

  3. GET file-name-to-be-viewed HTTP/1.0

    Use location where you put your file.

  4. Make one blank line. Important!
Now you should get the contents of the file on your terminal. At the beginning of this output there is a line

Content-type: XXXXXXXXX

XXXXXXX is a returned (that means recognized) MIME type (for example for postscript files it should be something like application/postscript.

If it is not: then something wrong must be on the server side (most probably the variable $SERVER_ROOT in Cfg.pl is not set properly). If yes: then .mailcap on the client side is wrong.


senger@ebi.ac.uk
Last modified: Thu Dec 28 18:00:26 2000