I want to dynamically determine the mimetype for a browser-requested
file so I can set the Content-Type response header appropriately in JHP.

I'm trying to decide whether I should try and call on an external
function (would obviously depend on OS)
E.g.
C# code for display MimeMap entries to the console from an instance of
IIS 
http://blog.crowe.co.nz/archive/2006/06/02/647.aspx

GNOME Desktop System Administration Guide - Detecting the MIME Type for
a File
http://www.gnome.org/learn/admin-guide/2.6/ch05s02.html

Or declare a hardcoded lookup table of extensions - much like the table
at the end of the C# code page linked above. It could be based on the
Mime media types registered here.
http://www.iana.org/assignments/media-types/

The CGI/Design page on the J Wiki suggests:
"* declare a list of standard mime type for validation, mapping of file
extensions and support of other content generation modules, such as
image converters"
http://www.jsoftware.com/jwiki/CGI/Design#head-7b9e531a572cabe4888ed5323
61d75734eb5f18e

This sounds more like the hardcoded lookup table and I'm inclined that
way myself, mainly from a portability point of view - I'm currently
using IIS but may want to shift to Linux/Apache at a later date. 

I'm interested in your thoughts.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to