In my last column, I discussed how Net.Data could create a Comma Separated Value (CSV) file dynamically. Recently, I have been involved in working with distribution of many types of publications and documents via the Web other than standard HTML documents. My own company wanted to begin publishing documents created with Microsoft Word, Microsoft Excel spreadsheets and, of course, XML.
There are many ways to accomplish this task. One method is to use Microsoft Office 2000's ability to publish any document from the suite of products as HTML. This is a good option, but it requires that users who produce documents understand how to convert documents to HTML and then modify the converted result to look and feel the way that they want. There is an easier way. Just upload the document to an IFS root directory of your choice in its native format (.doc, .csv, etc.). Microsoft Internet Explorer will examine the file extension and invoke the appropriate application (MS/Word, MS/EXCEL, MS/POWERPOINT, MS/ACCESS, etc.) automatically and integrate the view of the document within the browser.
Unfortunately, Netscape browsers, Opera and others require that you do some configuration on both your browser and your HTTP Server to enable the browser to invoke the appropriate application. Some applications, such as Adobe Acrobat, are pre-configured within the Netscape browser when you install the plug-in (i.e. Acrobat).
If you attempt to access a URL for CSV files, you will see the contents of the file displayed as plain text on the browser. To make Netscape and other browsers friendlier, you must implement the HTTP Server's Addtype directive for each type of file. This directive causes the server to modify the HTTP Header's content-type directive sent to the browser and enables the browser to look for applications defined to it to invoke the application.
The HTTP Server Admin interface provides a screen under "Languages and Encoding" heading called "Mime Types." Invoke the admin server by typing HTTP://yourserver.com:2001. You will need IOSYSCFG special authority and will be asked to log on with your AS/400 user profile. When you complete the form, an "AddType" directive will be added to your server. If you then attempt to serve a file with the file extension .csv, the browser will look in its list of Applications (under Edit, Preferences, Applications in Netscape), find the appropriate application and invoke it.
That seems easy, doesn't it? The big trick is finding the MIME content/types that you need to define. To read more about MIME content/types, check out the FAQ link from IGNITe/400 and then click the MIME link.
If you want more detailed information, check the same link and read about MIME content/types in the following RFC's (request for comments, which are the definitive Internet standards): RFC1341, RFC1521, RFC1590, RFC2045, RFC2046, RFC2047, RFC2048 and RFC2049. Also take the link to the Information Systems Institute RFC search engine and search on MIME.
If you look at the sample code pages on IGNITe/400, we demonstrate the use of MIME content types for displaying source code in the Net.Data macro area where we have defined the extensions: .mac and .hti with the following Addtype directives:
AddType .mac text/plain 8bit 1.0 ISO-8859-1 AddType .hti text/plain 8bit 1.0 ISO-8859-1
This was first published in March 2001