+
+ //get the content-type from what the client browser
+ //sends us. (the "Oreilly method")
+ String contentType = mpReq.getContentType();
+
+ theLog.printError("FROM BROWSER: "+contentType);
+
+ //if the client browser sent us unknown (text/plain is default)
+ //or if we got application/octet-stream, it's possible that
+ //the browser is in error, better check against the file extension
+ if (contentType.equals("text/plain") ||
+ contentType.equals("application/octet-stream")) {
+ /**
+ * This is just a temporary way to get the content-type via
+ * the .extension , we could maybe use a magic method, by looking
+ * at the header (first few bytes) of the file. (like the file(1)
+ * command).
+ * The Oreilly method relies on the content-type that the client
+ * browser sends and that sometimes is application-octet stream with
+ * broken/mis-configured browsers.
+ *
+ * The map file should be Mir/content-types.properties, it's the
+ * default Sun Java file with some additional entries that it did
+ * not have. So if you support a new media type you have to make
+ * sure that it is in this file -mh
+ */
+ contentType = FileUtil.guessContentTypeFromName(fileName);
+ theLog.printError("tYPE: "+contentType);
+ if (contentType==null)
+ contentType = "text/plain"; // rfc1867 says this is the default
+ }