编程技术笔记

MIME 媒体类型介绍

#HTTP #MIME

这篇文章主要回答这些内容:

  • 如何思考解决这个问题?

  • 如何获取文件的 MIME?

  • 如何实现 MIME 类型获取的工具?

起因:我准备实现一个 HTTP 服务器,在 Response 的 Content-Type 要设置文件类型,这种类型也是有规范的,那就是 MIME,我现在需要一个工具获取文件的类型。

首先想到的是看能不能用 jdk 的工具,查了下 jdk8 有个 MimetypesFileTypeMap 类可以用,但我用的是 jdk11,在这个版本已经剔除了这个类,如果用就需要增加一个依赖。这种方式的

使用方法:

1MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
2mimeTypesMap.getContentType(filePath);
3
4// 如果是高版本的jdk需要增加以下依赖
5<dependency>
6  <groupId>javax.activation</groupId>
7  <artifactId>activation</artifactId>
8  <version>1.1.1</version>
9</dependency>

在读这个 jdk 工具的源码后,发现这个工具并不是根据文件的魔数来判断的,是根据文件的扩展名判断的(e.g. .html),jdk 工具存储了一个配置文件,以获取文件扩展名与 MIME 的映射关系。

魔数:是在文件内容中固定的一个数字,标识一类文件

jdk 配置文件的部分内容:

 1#sun.net.www MIME content-types table
 2#
 3# Property fields:
 4#
 5#   <description> ::= 'description' '=' <descriptive string>
 6#    <extensions> ::= 'file_extensions' '=' <comma-delimited list, include '.'>
 7#         <image> ::= 'icon' '=' <filename of icon image>
 8#        <action> ::= 'browser' | 'application' | 'save' | 'unknown'
 9#   <application> ::= 'application' '=' <command line template>
10#
11
12#
13# The "we don't know anything about this data" type(s).
14# Used internally to mark unrecognized types.
15#
16content/unknown: description=Unknown Content
17unknown/unknown: description=Unknown Data Type
18
19#
20# The template we should use for temporary files when launching an application
21# to view a document of given type.
22#
23temp.file.template: /tmp/%s
24
25#
26# The "real" types.
27#
28application/octet-stream: \
29	description=Generic Binary Stream;\
30	file_extensions=.saveme,.dump,.hqx,.arc,.o,.a,.bin,.exe,.z,.gz
31
32application/oda: \
33	description=ODA Document;\
34	file_extensions=.oda
35
36application/pdf: \
37	description=Adobe PDF Format;\
38	file_extensions=.pdf
39
40	... ...

了解到这一点,我想到所有的 HTTP 应该都有判断文件类型这步操作,我准备看下 nginx 的 MIME 配置,到了配置文件中,果然见到了配置文件。如下:

 1types {
 2    text/html                                        html htm shtml;
 3    text/css                                         css;
 4    text/xml                                         xml;
 5    image/gif                                        gif;
 6    image/jpeg                                       jpeg jpg;
 7    application/javascript                           js;
 8    application/atom+xml                             atom;
 9    application/rss+xml                              rss;
10
11    text/mathml                                      mml;
12    text/plain                                       txt;
13    text/vnd.sun.j2me.app-descriptor                 jad;
14    text/vnd.wap.wml                                 wml;
15    text/x-component                                 htc;
16
17    image/png                                        png;
18    image/svg+xml                                    svg svgz;
19    image/tiff                                       tif tiff;
20    image/vnd.wap.wbmp                               wbmp;
21    image/webp                                       webp;
22    image/x-icon                                     ico;
23    image/x-jng                                      jng;
24    image/x-ms-bmp                                   bmp;
25
26    font/woff                                        woff;
27    font/woff2                                       woff2;
28
29    application/java-archive                         jar war ear;
30    application/json                                 json;
31    application/mac-binhex40                         hqx;
32    application/msword                               doc;
33    application/pdf                                  pdf;
34    application/postscript                           ps eps ai;
35    application/rtf                                  rtf;
36    application/vnd.apple.mpegurl                    m3u8;
37    application/vnd.google-earth.kml+xml             kml;
38    application/vnd.google-earth.kmz                 kmz;
39    application/vnd.ms-excel                         xls;
40    application/vnd.ms-fontobject                    eot;
41    application/vnd.ms-powerpoint                    ppt;
42    application/vnd.oasis.opendocument.graphics      odg;
43    application/vnd.oasis.opendocument.presentation  odp;
44    application/vnd.oasis.opendocument.spreadsheet   ods;
45    application/vnd.oasis.opendocument.text          odt;
46    application/vnd.openxmlformats-officedocument.presentationml.presentation
47                                                     pptx;
48    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
49                                                     xlsx;
50    application/vnd.openxmlformats-officedocument.wordprocessingml.document
51                                                     docx;
52    application/vnd.wap.wmlc                         wmlc;
53    application/x-7z-compressed                      7z;
54    application/x-cocoa                              cco;
55    application/x-java-archive-diff                  jardiff;
56    application/x-java-jnlp-file                     jnlp;
57    application/x-makeself                           run;
58    application/x-perl                               pl pm;
59    application/x-pilot                              prc pdb;
60    application/x-rar-compressed                     rar;
61    application/x-redhat-package-manager             rpm;
62    application/x-sea                                sea;
63    application/x-shockwave-flash                    swf;
64    application/x-stuffit                            sit;
65    application/x-tcl                                tcl tk;
66    application/x-x509-ca-cert                       der pem crt;
67    application/x-xpinstall                          xpi;
68    application/xhtml+xml                            xhtml;
69    application/xspf+xml                             xspf;
70    application/zip                                  zip;
71
72    application/octet-stream                         bin exe dll;
73    application/octet-stream                         deb;
74    application/octet-stream                         dmg;
75    application/octet-stream                         iso img;
76    application/octet-stream                         msi msp msm;
77
78    audio/midi                                       mid midi kar;
79    audio/mpeg                                       mp3;
80    audio/ogg                                        ogg;
81    audio/x-m4a                                      m4a;
82    audio/x-realaudio                                ra;
83
84    video/3gpp                                       3gpp 3gp;
85    video/mp2t                                       ts;
86    video/mp4                                        mp4;
87    video/mpeg                                       mpeg mpg;
88    video/quicktime                                  mov;
89    video/webm                                       webm;
90    video/x-flv                                      flv;
91    video/x-m4v                                      m4v;
92    video/x-mng                                      mng;
93    video/x-ms-asf                                   asx asf;
94    video/x-ms-wmv                                   wmv;
95    video/x-msvideo                                  avi;
96}

到这里我就明白了这个功能如何实现完成,把 nginx 或者 jdk 的配置文件内容转换成一个判断程序就行了。以下是这个工具的实现。

Java 工具类实现

  1/**
  2 * 依据文件名获取MimeType
  3 */
  4public class MimeUtils {
  5
  6    private static Map<String, String> mapMimeType = new HashMap<>();
  7
  8    // 依据文件名获取MimeType
  9    public static String getType(String fileName) {
 10        if (fileName == null || "".equals(fileName.trim()) || fileName.indexOf(".") <= 0) {
 11            return "";
 12        }
 13        String suffix = fileName.substring(fileName.indexOf('.') + 1, fileName.length());
 14        return mapMimeType.getOrDefault(suffix.toLowerCase(), "*/*");
 15    }
 16
 17    private MimeUtils() {
 18
 19    }
 20
 21		// init
 22    static {
 23        mapMimeType.put("123", "application/vnd.lotus-1-2-3");
 24        mapMimeType.put("3gp", "video/3gpp");
 25        mapMimeType.put("aab", "application/x-authoware-bin");
 26        mapMimeType.put("aam", "application/x-authoware-map");
 27        mapMimeType.put("aas", "application/x-authoware-seg");
 28        mapMimeType.put("ai", "application/postscript");
 29        mapMimeType.put("aif", "audio/x-aiff");
 30        mapMimeType.put("aifc", "audio/x-aiff");
 31        mapMimeType.put("aiff", "audio/x-aiff");
 32        mapMimeType.put("als", "audio/X-Alpha5");
 33        mapMimeType.put("amc", "application/x-mpeg");
 34        mapMimeType.put("ani", "application/octet-stream");
 35        mapMimeType.put("asc", "text/plain");
 36        mapMimeType.put("asd", "application/astound");
 37        mapMimeType.put("asf", "video/x-ms-asf");
 38        mapMimeType.put("asn", "application/astound");
 39        mapMimeType.put("asp", "application/x-asap");
 40        mapMimeType.put("asx", "video/x-ms-asf");
 41        mapMimeType.put("au", "audio/basic");
 42        mapMimeType.put("avb", "application/octet-stream");
 43        mapMimeType.put("avi", "video/x-msvideo");
 44        mapMimeType.put("awb", "audio/amr-wb");
 45        mapMimeType.put("bcpio", "application/x-bcpio");
 46        mapMimeType.put("bin", "application/octet-stream");
 47        mapMimeType.put("bld", "application/bld");
 48        mapMimeType.put("bld2", "application/bld2");
 49        mapMimeType.put("bmp", "application/x-MS-bmp");
 50        mapMimeType.put("bpk", "application/octet-stream");
 51        mapMimeType.put("bz2", "application/x-bzip2");
 52        mapMimeType.put("cal", "image/x-cals");
 53        mapMimeType.put("ccn", "application/x-cnc");
 54        mapMimeType.put("cco", "application/x-cocoa");
 55        mapMimeType.put("cdf", "application/x-netcdf");
 56        mapMimeType.put("cgi", "magnus-internal/cgi");
 57        mapMimeType.put("chat", "application/x-chat");
 58        mapMimeType.put("class", "application/octet-stream");
 59        mapMimeType.put("clp", "application/x-msclip");
 60        mapMimeType.put("cmx", "application/x-cmx");
 61        mapMimeType.put("co", "application/x-cult3d-object");
 62        mapMimeType.put("cod", "image/cis-cod");
 63        mapMimeType.put("cpio", "application/x-cpio");
 64        mapMimeType.put("cpt", "application/mac-compactpro");
 65        mapMimeType.put("crd", "application/x-mscardfile");
 66        mapMimeType.put("csh", "application/x-csh");
 67        mapMimeType.put("csm", "chemical/x-csml");
 68        mapMimeType.put("csml", "chemical/x-csml");
 69        mapMimeType.put("css", "text/css");
 70        mapMimeType.put("cur", "application/octet-stream");
 71        mapMimeType.put("dcm", "x-lml/x-evm");
 72        mapMimeType.put("dcr", "application/x-director");
 73        mapMimeType.put("dcx", "image/x-dcx");
 74        mapMimeType.put("dhtml", "text/html");
 75        mapMimeType.put("dir", "application/x-director");
 76        mapMimeType.put("dll", "application/octet-stream");
 77        mapMimeType.put("dmg", "application/octet-stream");
 78        mapMimeType.put("dms", "application/octet-stream");
 79        mapMimeType.put("doc", "application/msword");
 80        mapMimeType.put("docx", "application/msword");
 81        mapMimeType.put("dot", "application/x-dot");
 82        mapMimeType.put("dvi", "application/x-dvi");
 83        mapMimeType.put("dwf", "drawing/x-dwf");
 84        mapMimeType.put("dwg", "application/x-autocad");
 85        mapMimeType.put("dxf", "application/x-autocad");
 86        mapMimeType.put("dxr", "application/x-director");
 87        mapMimeType.put("ebk", "application/x-expandedbook");
 88        mapMimeType.put("emb", "chemical/x-embl-dl-nucleotide");
 89        mapMimeType.put("embl", "chemical/x-embl-dl-nucleotide");
 90        mapMimeType.put("eps", "application/postscript");
 91        mapMimeType.put("eri", "image/x-eri");
 92        mapMimeType.put("es", "audio/echospeech");
 93        mapMimeType.put("esl", "audio/echospeech");
 94        mapMimeType.put("etc", "application/x-earthtime");
 95        mapMimeType.put("etx", "text/x-setext");
 96        mapMimeType.put("evm", "x-lml/x-evm");
 97        mapMimeType.put("evy", "application/x-envoy");
 98        mapMimeType.put("exe", "application/octet-stream");
 99        mapMimeType.put("fh4", "image/x-freehand");
100        mapMimeType.put("fh5", "image/x-freehand");
101        mapMimeType.put("fhc", "image/x-freehand");
102        mapMimeType.put("fif", "image/fif");
103        mapMimeType.put("fm", "application/x-maker");
104        mapMimeType.put("fpx", "image/x-fpx");
105        mapMimeType.put("fvi", "video/isivideo");
106        mapMimeType.put("gau", "chemical/x-gaussian-input");
107        mapMimeType.put("gca", "application/x-gca-compressed");
108        mapMimeType.put("gdb", "x-lml/x-gdb");
109        mapMimeType.put("gif", "image/gif");
110        mapMimeType.put("gps", "application/x-gps");
111        mapMimeType.put("gtar", "application/x-gtar");
112        mapMimeType.put("gz", "application/x-gzip");
113        mapMimeType.put("hdf", "application/x-hdf");
114        mapMimeType.put("hdm", "text/x-hdml");
115        mapMimeType.put("hdml", "text/x-hdml");
116        mapMimeType.put("hlp", "application/winhlp");
117        mapMimeType.put("hqx", "application/mac-binhex40");
118        mapMimeType.put("htm", "text/html");
119        mapMimeType.put("html", "text/html");
120        mapMimeType.put("hts", "text/html");
121        mapMimeType.put("ice", "x-conference/x-cooltalk");
122        mapMimeType.put("ico", "application/octet-stream");
123        mapMimeType.put("ief", "image/ief");
124        mapMimeType.put("ifm", "image/gif");
125        mapMimeType.put("ifs", "image/ifs");
126        mapMimeType.put("imy", "audio/melody");
127        mapMimeType.put("ins", "application/x-NET-Install");
128        mapMimeType.put("ips", "application/x-ipscript");
129        mapMimeType.put("ipx", "application/x-ipix");
130        mapMimeType.put("it", "audio/x-mod");
131        mapMimeType.put("itz", "audio/x-mod");
132        mapMimeType.put("ivr", "i-world/i-vrml");
133        mapMimeType.put("j2k", "image/j2k");
134        mapMimeType.put("jad", "text/vnd.sun.j2me.app-descriptor");
135        mapMimeType.put("jam", "application/x-jam");
136        mapMimeType.put("jar", "application/java-archive");
137        mapMimeType.put("jnlp", "application/x-java-jnlp-file");
138        mapMimeType.put("jpe", "image/jpeg");
139        mapMimeType.put("jpeg", "image/jpeg");
140        mapMimeType.put("jpg", "image/jpeg");
141        mapMimeType.put("jpz", "image/jpeg");
142        mapMimeType.put("js", "application/x-javascript");
143        mapMimeType.put("jwc", "application/jwc");
144        mapMimeType.put("kjx", "application/x-kjx");
145        mapMimeType.put("lak", "x-lml/x-lak");
146        mapMimeType.put("latex", "application/x-latex");
147        mapMimeType.put("lcc", "application/fastman");
148        mapMimeType.put("lcl", "application/x-digitalloca");
149        mapMimeType.put("lcr", "application/x-digitalloca");
150        mapMimeType.put("lgh", "application/lgh");
151        mapMimeType.put("lha", "application/octet-stream");
152        mapMimeType.put("lml", "x-lml/x-lml");
153        mapMimeType.put("lmlpack", "x-lml/x-lmlpack");
154        mapMimeType.put("lsf", "video/x-ms-asf");
155        mapMimeType.put("lsx", "video/x-ms-asf");
156        mapMimeType.put("lzh", "application/x-lzh");
157        mapMimeType.put("m13", "application/x-msmediaview");
158        mapMimeType.put("m14", "application/x-msmediaview");
159        mapMimeType.put("m15", "audio/x-mod");
160        mapMimeType.put("m3u", "audio/x-mpegurl");
161        mapMimeType.put("m3url", "audio/x-mpegurl");
162        mapMimeType.put("ma1", "audio/ma1");
163        mapMimeType.put("ma2", "audio/ma2");
164        mapMimeType.put("ma3", "audio/ma3");
165        mapMimeType.put("ma5", "audio/ma5");
166        mapMimeType.put("man", "application/x-troff-man");
167        mapMimeType.put("map", "magnus-internal/imagemap");
168        mapMimeType.put("mbd", "application/mbedlet");
169        mapMimeType.put("mct", "application/x-mascot");
170        mapMimeType.put("mdb", "application/x-msaccess");
171        mapMimeType.put("mdz", "audio/x-mod");
172        mapMimeType.put("me", "application/x-troff-me");
173        mapMimeType.put("mel", "text/x-vmel");
174        mapMimeType.put("mi", "application/x-mif");
175        mapMimeType.put("mid", "audio/midi");
176        mapMimeType.put("midi", "audio/midi");
177        mapMimeType.put("mif", "application/x-mif");
178        mapMimeType.put("mil", "image/x-cals");
179        mapMimeType.put("mio", "audio/x-mio");
180        mapMimeType.put("mmf", "application/x-skt-lbs");
181        mapMimeType.put("mng", "video/x-mng");
182        mapMimeType.put("mny", "application/x-msmoney");
183        mapMimeType.put("moc", "application/x-mocha");
184        mapMimeType.put("mocha", "application/x-mocha");
185        mapMimeType.put("mod", "audio/x-mod");
186        mapMimeType.put("mof", "application/x-yumekara");
187        mapMimeType.put("mol", "chemical/x-mdl-molfile");
188        mapMimeType.put("mop", "chemical/x-mopac-input");
189        mapMimeType.put("mov", "video/quicktime");
190        mapMimeType.put("movie", "video/x-sgi-movie");
191        mapMimeType.put("mp2", "audio/x-mpeg");
192        mapMimeType.put("mp3", "audio/x-mpeg");
193        mapMimeType.put("mp4", "video/mp4");
194        mapMimeType.put("mpc", "application/vnd.mpohun.certificate");
195        mapMimeType.put("mpe", "video/mpeg");
196        mapMimeType.put("mpeg", "video/mpeg");
197        mapMimeType.put("mpg", "video/mpeg");
198        mapMimeType.put("mpg4", "video/mp4");
199        mapMimeType.put("mpga", "audio/mpeg");
200        mapMimeType.put("mpn", "application/vnd.mophun.application");
201        mapMimeType.put("mpp", "application/vnd.ms-project");
202        mapMimeType.put("mps", "application/x-mapserver");
203        mapMimeType.put("mrl", "text/x-mrml");
204        mapMimeType.put("mrm", "application/x-mrm");
205        mapMimeType.put("ms", "application/x-troff-ms");
206        mapMimeType.put("mts", "application/metastream");
207        mapMimeType.put("mtx", "application/metastream");
208        mapMimeType.put("mtz", "application/metastream");
209        mapMimeType.put("mzv", "application/metastream");
210        mapMimeType.put("nar", "application/zip");
211        mapMimeType.put("nbmp", "image/nbmp");
212        mapMimeType.put("nc", "application/x-netcdf");
213        mapMimeType.put("ndb", "x-lml/x-ndb");
214        mapMimeType.put("ndwn", "application/ndwn");
215        mapMimeType.put("nif", "application/x-nif");
216        mapMimeType.put("nmz", "application/x-scream");
217        mapMimeType.put("nokia-op-logo", "image/vnd.nok-oplogo-color");
218        mapMimeType.put("npx", "application/x-netfpx");
219        mapMimeType.put("nsnd", "audio/nsnd");
220        mapMimeType.put("nva", "application/x-neva1");
221        mapMimeType.put("oda", "application/oda");
222        mapMimeType.put("oom", "application/x-AtlasMate-Plugin");
223        mapMimeType.put("pac", "audio/x-pac");
224        mapMimeType.put("pae", "audio/x-epac");
225        mapMimeType.put("pan", "application/x-pan");
226        mapMimeType.put("pbm", "image/x-portable-bitmap");
227        mapMimeType.put("pcx", "image/x-pcx");
228        mapMimeType.put("pda", "image/x-pda");
229        mapMimeType.put("pdb", "chemical/x-pdb");
230        mapMimeType.put("pdf", "application/pdf");
231        mapMimeType.put("pfr", "application/font-tdpfr");
232        mapMimeType.put("pgm", "image/x-portable-graymap");
233        mapMimeType.put("pict", "image/x-pict");
234        mapMimeType.put("pm", "application/x-perl");
235        mapMimeType.put("pmd", "application/x-pmd");
236        mapMimeType.put("png", "image/png");
237        mapMimeType.put("pnm", "image/x-portable-anymap");
238        mapMimeType.put("pnz", "image/png");
239        mapMimeType.put("pot", "application/vnd.ms-powerpoint");
240        mapMimeType.put("ppm", "image/x-portable-pixmap");
241        mapMimeType.put("pps", "application/vnd.ms-powerpoint");
242        mapMimeType.put("ppt", "application/vnd.ms-powerpoint");
243        mapMimeType.put("pptx", "application/vnd.ms-powerpoint");
244        mapMimeType.put("pqf", "application/x-cprplayer");
245        mapMimeType.put("pqi", "application/cprplayer");
246        mapMimeType.put("prc", "application/x-prc");
247        mapMimeType.put("proxy", "application/x-ns-proxy-autoconfig");
248        mapMimeType.put("ps", "application/postscript");
249        mapMimeType.put("ptlk", "application/listenup");
250        mapMimeType.put("pub", "application/x-mspublisher");
251        mapMimeType.put("pvx", "video/x-pv-pvx");
252        mapMimeType.put("qcp", "audio/vnd.qcelp");
253        mapMimeType.put("qt", "video/quicktime");
254        mapMimeType.put("qti", "image/x-quicktime");
255        mapMimeType.put("qtif", "image/x-quicktime");
256        mapMimeType.put("r3t", "text/vnd.rn-realtext3d");
257        mapMimeType.put("ra", "audio/x-pn-realaudio");
258        mapMimeType.put("ram", "audio/x-pn-realaudio");
259        mapMimeType.put("rar", "application/x-rar-compressed");
260        mapMimeType.put("ras", "image/x-cmu-raster");
261        mapMimeType.put("rdf", "application/rdf+xml");
262        mapMimeType.put("rf", "image/vnd.rn-realflash");
263        mapMimeType.put("rgb", "image/x-rgb");
264        mapMimeType.put("rlf", "application/x-richlink");
265        mapMimeType.put("rm", "audio/x-pn-realaudio");
266        mapMimeType.put("rmf", "audio/x-rmf");
267        mapMimeType.put("rmm", "audio/x-pn-realaudio");
268        mapMimeType.put("rmvb", "audio/x-pn-realaudio");
269        mapMimeType.put("rnx", "application/vnd.rn-realplayer");
270        mapMimeType.put("roff", "application/x-troff");
271        mapMimeType.put("rp", "image/vnd.rn-realpix");
272        mapMimeType.put("rpm", "audio/x-pn-realaudio-plugin");
273        mapMimeType.put("rt", "text/vnd.rn-realtext");
274        mapMimeType.put("rte", "x-lml/x-gps");
275        mapMimeType.put("rtf", "application/rtf");
276        mapMimeType.put("rtg", "application/metastream");
277        mapMimeType.put("rtx", "text/richtext");
278        mapMimeType.put("rv", "video/vnd.rn-realvideo");
279        mapMimeType.put("rwc", "application/x-rogerwilco");
280        mapMimeType.put("s3m", "audio/x-mod");
281        mapMimeType.put("s3z", "audio/x-mod");
282        mapMimeType.put("sca", "application/x-supercard");
283        mapMimeType.put("scd", "application/x-msschedule");
284        mapMimeType.put("sdf", "application/e-score");
285        mapMimeType.put("sea", "application/x-stuffit");
286        mapMimeType.put("sgm", "text/x-sgml");
287        mapMimeType.put("sgml", "text/x-sgml");
288        mapMimeType.put("sh", "application/x-sh");
289        mapMimeType.put("shar", "application/x-shar");
290        mapMimeType.put("shtml", "magnus-internal/parsed-html");
291        mapMimeType.put("shw", "application/presentations");
292        mapMimeType.put("si6", "image/si6");
293        mapMimeType.put("si7", "image/vnd.stiwap.sis");
294        mapMimeType.put("si9", "image/vnd.lgtwap.sis");
295        mapMimeType.put("sis", "application/vnd.symbian.install");
296        mapMimeType.put("sit", "application/x-stuffit");
297        mapMimeType.put("skd", "application/x-Koan");
298        mapMimeType.put("skm", "application/x-Koan");
299        mapMimeType.put("skp", "application/x-Koan");
300        mapMimeType.put("skt", "application/x-Koan");
301        mapMimeType.put("slc", "application/x-salsa");
302        mapMimeType.put("smd", "audio/x-smd");
303        mapMimeType.put("smi", "application/smil");
304        mapMimeType.put("smil", "application/smil");
305        mapMimeType.put("smp", "application/studiom");
306        mapMimeType.put("smz", "audio/x-smd");
307        mapMimeType.put("snd", "audio/basic");
308        mapMimeType.put("spc", "text/x-speech");
309        mapMimeType.put("spl", "application/futuresplash");
310        mapMimeType.put("spr", "application/x-sprite");
311        mapMimeType.put("sprite", "application/x-sprite");
312        mapMimeType.put("spt", "application/x-spt");
313        mapMimeType.put("src", "application/x-wais-source");
314        mapMimeType.put("stk", "application/hyperstudio");
315        mapMimeType.put("stm", "audio/x-mod");
316        mapMimeType.put("sv4cpio", "application/x-sv4cpio");
317        mapMimeType.put("sv4crc", "application/x-sv4crc");
318        mapMimeType.put("svf", "image/vnd");
319        mapMimeType.put("svg", "image/svg-xml");
320        mapMimeType.put("svh", "image/svh");
321        mapMimeType.put("svr", "x-world/x-svr");
322        mapMimeType.put("swf", "application/x-shockwave-flash");
323        mapMimeType.put("swfl", "application/x-shockwave-flash");
324        mapMimeType.put("t", "application/x-troff");
325        mapMimeType.put("tad", "application/octet-stream");
326        mapMimeType.put("talk", "text/x-speech");
327        mapMimeType.put("tar", "application/x-tar");
328        mapMimeType.put("taz", "application/x-tar");
329        mapMimeType.put("tbp", "application/x-timbuktu");
330        mapMimeType.put("tbt", "application/x-timbuktu");
331        mapMimeType.put("tcl", "application/x-tcl");
332        mapMimeType.put("tex", "application/x-tex");
333        mapMimeType.put("texi", "application/x-texinfo");
334        mapMimeType.put("texinfo", "application/x-texinfo");
335        mapMimeType.put("tgz", "application/x-tar");
336        mapMimeType.put("thm", "application/vnd.eri.thm");
337        mapMimeType.put("tif", "image/tiff");
338        mapMimeType.put("tiff", "image/tiff");
339        mapMimeType.put("tki", "application/x-tkined");
340        mapMimeType.put("tkined", "application/x-tkined");
341        mapMimeType.put("toc", "application/toc");
342        mapMimeType.put("toy", "image/toy");
343        mapMimeType.put("tr", "application/x-troff");
344        mapMimeType.put("trk", "x-lml/x-gps");
345        mapMimeType.put("trm", "application/x-msterminal");
346        mapMimeType.put("tsi", "audio/tsplayer");
347        mapMimeType.put("tsp", "application/dsptype");
348        mapMimeType.put("tsv", "text/tab-separated-values");
349        mapMimeType.put("tsv", "text/tab-separated-values");
350        mapMimeType.put("ttf", "application/octet-stream");
351        mapMimeType.put("ttz", "application/t-time");
352        mapMimeType.put("txt", "text/plain");
353        mapMimeType.put("ult", "audio/x-mod");
354        mapMimeType.put("ustar", "application/x-ustar");
355        mapMimeType.put("uu", "application/x-uuencode");
356        mapMimeType.put("uue", "application/x-uuencode");
357        mapMimeType.put("vcd", "application/x-cdlink");
358        mapMimeType.put("vcf", "text/x-vcard");
359        mapMimeType.put("vdo", "video/vdo");
360        mapMimeType.put("vib", "audio/vib");
361        mapMimeType.put("viv", "video/vivo");
362        mapMimeType.put("vivo", "video/vivo");
363        mapMimeType.put("vmd", "application/vocaltec-media-desc");
364        mapMimeType.put("vmf", "application/vocaltec-media-file");
365        mapMimeType.put("vmi", "application/x-dreamcast-vms-info");
366        mapMimeType.put("vms", "application/x-dreamcast-vms");
367        mapMimeType.put("vox", "audio/voxware");
368        mapMimeType.put("vqe", "audio/x-twinvq-plugin");
369        mapMimeType.put("vqf", "audio/x-twinvq");
370        mapMimeType.put("vql", "audio/x-twinvq");
371        mapMimeType.put("vre", "x-world/x-vream");
372        mapMimeType.put("vrml", "x-world/x-vrml");
373        mapMimeType.put("vrt", "x-world/x-vrt");
374        mapMimeType.put("vrw", "x-world/x-vream");
375        mapMimeType.put("vts", "workbook/formulaone");
376        mapMimeType.put("wav", "audio/x-wav");
377        mapMimeType.put("wax", "audio/x-ms-wax");
378        mapMimeType.put("wbmp", "image/vnd.wap.wbmp");
379        mapMimeType.put("web", "application/vnd.xara");
380        mapMimeType.put("wi", "image/wavelet");
381        mapMimeType.put("wis", "application/x-InstallShield");
382        mapMimeType.put("wm", "video/x-ms-wm");
383        mapMimeType.put("wma", "audio/x-ms-wma");
384        mapMimeType.put("wmd", "application/x-ms-wmd");
385        mapMimeType.put("wmf", "application/x-msmetafile");
386        mapMimeType.put("wml", "text/vnd.wap.wml");
387        mapMimeType.put("wmlc", "application/vnd.wap.wmlc");
388        mapMimeType.put("wmls", "text/vnd.wap.wmlscript");
389        mapMimeType.put("wmlsc", "application/vnd.wap.wmlscriptc");
390        mapMimeType.put("wmlscript", "text/vnd.wap.wmlscript");
391        mapMimeType.put("wmv", "audio/x-ms-wmv");
392        mapMimeType.put("wmx", "video/x-ms-wmx");
393        mapMimeType.put("wmz", "application/x-ms-wmz");
394        mapMimeType.put("wpng", "image/x-up-wpng");
395        mapMimeType.put("wpt", "x-lml/x-gps");
396        mapMimeType.put("wri", "application/x-mswrite");
397        mapMimeType.put("wrl", "x-world/x-vrml");
398        mapMimeType.put("wrz", "x-world/x-vrml");
399        mapMimeType.put("ws", "text/vnd.wap.wmlscript");
400        mapMimeType.put("wsc", "application/vnd.wap.wmlscriptc");
401        mapMimeType.put("wv", "video/wavelet");
402        mapMimeType.put("wvx", "video/x-ms-wvx");
403        mapMimeType.put("wxl", "application/x-wxl");
404        mapMimeType.put("x-gzip", "application/x-gzip");
405        mapMimeType.put("xar", "application/vnd.xara");
406        mapMimeType.put("xbm", "image/x-xbitmap");
407        mapMimeType.put("xdm", "application/x-xdma");
408        mapMimeType.put("xdma", "application/x-xdma");
409        mapMimeType.put("xdw", "application/vnd.fujixerox.docuworks");
410        mapMimeType.put("xht", "application/xhtml+xml");
411        mapMimeType.put("xhtm", "application/xhtml+xml");
412        mapMimeType.put("xhtml", "application/xhtml+xml");
413        mapMimeType.put("xla", "application/vnd.ms-excel");
414        mapMimeType.put("xlc", "application/vnd.ms-excel");
415        mapMimeType.put("xll", "application/x-excel");
416        mapMimeType.put("xlm", "application/vnd.ms-excel");
417        mapMimeType.put("xls", "application/vnd.ms-excel");
418        mapMimeType.put("xlsx", "application/vnd.ms-excel");
419        mapMimeType.put("xlt", "application/vnd.ms-excel");
420        mapMimeType.put("xlw", "application/vnd.ms-excel");
421        mapMimeType.put("xm", "audio/x-mod");
422        mapMimeType.put("xml", "text/xml");
423        mapMimeType.put("xmz", "audio/x-mod");
424        mapMimeType.put("xpi", "application/x-xpinstall");
425        mapMimeType.put("xpm", "image/x-xpixmap");
426        mapMimeType.put("xsit", "text/xml");
427        mapMimeType.put("xsl", "text/xml");
428        mapMimeType.put("xul", "text/xul");
429        mapMimeType.put("xwd", "image/x-xwindowdump");
430        mapMimeType.put("xyz", "chemical/x-pdb");
431        mapMimeType.put("yz1", "application/x-yz1");
432        mapMimeType.put("z", "application/x-compress");
433        mapMimeType.put("zac", "application/x-zaurus-zac");
434        mapMimeType.put("zip", "application/zip");
435    }
436
437}

Top↑
comments powered by Disqus