MIME 媒体类型

MIME 媒体类型

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

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

  • 如何获取文件的MIME?

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

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

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

使用方法:

MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
mimeTypesMap.getContentType(filePath);

// 如果是高版本的jdk需要增加以下依赖
<dependency>
  <groupId>javax.activation</groupId>
  <artifactId>activation</artifactId>
  <version>1.1.1</version>
</dependency>

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

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

jdk配置文件的部分内容:

#sun.net.www MIME content-types table
#
# Property fields:
#
#   <description> ::= 'description' '=' <descriptive string>
#    <extensions> ::= 'file_extensions' '=' <comma-delimited list, include '.'>
#         <image> ::= 'icon' '=' <filename of icon image>
#        <action> ::= 'browser' | 'application' | 'save' | 'unknown'
#   <application> ::= 'application' '=' <command line template>
#

#
# The "we don't know anything about this data" type(s).
# Used internally to mark unrecognized types.
#
content/unknown: description=Unknown Content
unknown/unknown: description=Unknown Data Type

#
# The template we should use for temporary files when launching an application
# to view a document of given type.
#
temp.file.template: /tmp/%s

#
# The "real" types.
#
application/octet-stream: \
	description=Generic Binary Stream;\
	file_extensions=.saveme,.dump,.hqx,.arc,.o,.a,.bin,.exe,.z,.gz

application/oda: \
	description=ODA Document;\
	file_extensions=.oda

application/pdf: \
	description=Adobe PDF Format;\
	file_extensions=.pdf
	
	... ...

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

types {
    text/html                                        html htm shtml;
    text/css                                         css;
    text/xml                                         xml;
    image/gif                                        gif;
    image/jpeg                                       jpeg jpg;
    application/javascript                           js;
    application/atom+xml                             atom;
    application/rss+xml                              rss;

    text/mathml                                      mml;
    text/plain                                       txt;
    text/vnd.sun.j2me.app-descriptor                 jad;
    text/vnd.wap.wml                                 wml;
    text/x-component                                 htc;

    image/png                                        png;
    image/svg+xml                                    svg svgz;
    image/tiff                                       tif tiff;
    image/vnd.wap.wbmp                               wbmp;
    image/webp                                       webp;
    image/x-icon                                     ico;
    image/x-jng                                      jng;
    image/x-ms-bmp                                   bmp;

    font/woff                                        woff;
    font/woff2                                       woff2;

    application/java-archive                         jar war ear;
    application/json                                 json;
    application/mac-binhex40                         hqx;
    application/msword                               doc;
    application/pdf                                  pdf;
    application/postscript                           ps eps ai;
    application/rtf                                  rtf;
    application/vnd.apple.mpegurl                    m3u8;
    application/vnd.google-earth.kml+xml             kml;
    application/vnd.google-earth.kmz                 kmz;
    application/vnd.ms-excel                         xls;
    application/vnd.ms-fontobject                    eot;
    application/vnd.ms-powerpoint                    ppt;
    application/vnd.oasis.opendocument.graphics      odg;
    application/vnd.oasis.opendocument.presentation  odp;
    application/vnd.oasis.opendocument.spreadsheet   ods;
    application/vnd.oasis.opendocument.text          odt;
    application/vnd.openxmlformats-officedocument.presentationml.presentation
                                                     pptx;
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
                                                     xlsx;
    application/vnd.openxmlformats-officedocument.wordprocessingml.document
                                                     docx;
    application/vnd.wap.wmlc                         wmlc;
    application/x-7z-compressed                      7z;
    application/x-cocoa                              cco;
    application/x-java-archive-diff                  jardiff;
    application/x-java-jnlp-file                     jnlp;
    application/x-makeself                           run;
    application/x-perl                               pl pm;
    application/x-pilot                              prc pdb;
    application/x-rar-compressed                     rar;
    application/x-redhat-package-manager             rpm;
    application/x-sea                                sea;
    application/x-shockwave-flash                    swf;
    application/x-stuffit                            sit;
    application/x-tcl                                tcl tk;
    application/x-x509-ca-cert                       der pem crt;
    application/x-xpinstall                          xpi;
    application/xhtml+xml                            xhtml;
    application/xspf+xml                             xspf;
    application/zip                                  zip;

    application/octet-stream                         bin exe dll;
    application/octet-stream                         deb;
    application/octet-stream                         dmg;
    application/octet-stream                         iso img;
    application/octet-stream                         msi msp msm;

    audio/midi                                       mid midi kar;
    audio/mpeg                                       mp3;
    audio/ogg                                        ogg;
    audio/x-m4a                                      m4a;
    audio/x-realaudio                                ra;

    video/3gpp                                       3gpp 3gp;
    video/mp2t                                       ts;
    video/mp4                                        mp4;
    video/mpeg                                       mpeg mpg;
    video/quicktime                                  mov;
    video/webm                                       webm;
    video/x-flv                                      flv;
    video/x-m4v                                      m4v;
    video/x-mng                                      mng;
    video/x-ms-asf                                   asx asf;
    video/x-ms-wmv                                   wmv;
    video/x-msvideo                                  avi;
}

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

Java工具类实现

/**
 * 依据文件名获取MimeType
 */
public class MimeUtils {

    private static Map<String, String> mapMimeType = new HashMap<>();

    // 依据文件名获取MimeType
    public static String getType(String fileName) {
        if (fileName == null || "".equals(fileName.trim()) || fileName.indexOf(".") <= 0) {
            return "";
        }
        String suffix = fileName.substring(fileName.indexOf('.') + 1, fileName.length());
        return mapMimeType.getOrDefault(suffix.toLowerCase(), "*/*");
    }

    private MimeUtils() {

    }

		// init
    static {
        mapMimeType.put("123", "application/vnd.lotus-1-2-3");
        mapMimeType.put("3gp", "video/3gpp");
        mapMimeType.put("aab", "application/x-authoware-bin");
        mapMimeType.put("aam", "application/x-authoware-map");
        mapMimeType.put("aas", "application/x-authoware-seg");
        mapMimeType.put("ai", "application/postscript");
        mapMimeType.put("aif", "audio/x-aiff");
        mapMimeType.put("aifc", "audio/x-aiff");
        mapMimeType.put("aiff", "audio/x-aiff");
        mapMimeType.put("als", "audio/X-Alpha5");
        mapMimeType.put("amc", "application/x-mpeg");
        mapMimeType.put("ani", "application/octet-stream");
        mapMimeType.put("asc", "text/plain");
        mapMimeType.put("asd", "application/astound");
        mapMimeType.put("asf", "video/x-ms-asf");
        mapMimeType.put("asn", "application/astound");
        mapMimeType.put("asp", "application/x-asap");
        mapMimeType.put("asx", "video/x-ms-asf");
        mapMimeType.put("au", "audio/basic");
        mapMimeType.put("avb", "application/octet-stream");
        mapMimeType.put("avi", "video/x-msvideo");
        mapMimeType.put("awb", "audio/amr-wb");
        mapMimeType.put("bcpio", "application/x-bcpio");
        mapMimeType.put("bin", "application/octet-stream");
        mapMimeType.put("bld", "application/bld");
        mapMimeType.put("bld2", "application/bld2");
        mapMimeType.put("bmp", "application/x-MS-bmp");
        mapMimeType.put("bpk", "application/octet-stream");
        mapMimeType.put("bz2", "application/x-bzip2");
        mapMimeType.put("cal", "image/x-cals");
        mapMimeType.put("ccn", "application/x-cnc");
        mapMimeType.put("cco", "application/x-cocoa");
        mapMimeType.put("cdf", "application/x-netcdf");
        mapMimeType.put("cgi", "magnus-internal/cgi");
        mapMimeType.put("chat", "application/x-chat");
        mapMimeType.put("class", "application/octet-stream");
        mapMimeType.put("clp", "application/x-msclip");
        mapMimeType.put("cmx", "application/x-cmx");
        mapMimeType.put("co", "application/x-cult3d-object");
        mapMimeType.put("cod", "image/cis-cod");
        mapMimeType.put("cpio", "application/x-cpio");
        mapMimeType.put("cpt", "application/mac-compactpro");
        mapMimeType.put("crd", "application/x-mscardfile");
        mapMimeType.put("csh", "application/x-csh");
        mapMimeType.put("csm", "chemical/x-csml");
        mapMimeType.put("csml", "chemical/x-csml");
        mapMimeType.put("css", "text/css");
        mapMimeType.put("cur", "application/octet-stream");
        mapMimeType.put("dcm", "x-lml/x-evm");
        mapMimeType.put("dcr", "application/x-director");
        mapMimeType.put("dcx", "image/x-dcx");
        mapMimeType.put("dhtml", "text/html");
        mapMimeType.put("dir", "application/x-director");
        mapMimeType.put("dll", "application/octet-stream");
        mapMimeType.put("dmg", "application/octet-stream");
        mapMimeType.put("dms", "application/octet-stream");
        mapMimeType.put("doc", "application/msword");
        mapMimeType.put("docx", "application/msword");
        mapMimeType.put("dot", "application/x-dot");
        mapMimeType.put("dvi", "application/x-dvi");
        mapMimeType.put("dwf", "drawing/x-dwf");
        mapMimeType.put("dwg", "application/x-autocad");
        mapMimeType.put("dxf", "application/x-autocad");
        mapMimeType.put("dxr", "application/x-director");
        mapMimeType.put("ebk", "application/x-expandedbook");
        mapMimeType.put("emb", "chemical/x-embl-dl-nucleotide");
        mapMimeType.put("embl", "chemical/x-embl-dl-nucleotide");
        mapMimeType.put("eps", "application/postscript");
        mapMimeType.put("eri", "image/x-eri");
        mapMimeType.put("es", "audio/echospeech");
        mapMimeType.put("esl", "audio/echospeech");
        mapMimeType.put("etc", "application/x-earthtime");
        mapMimeType.put("etx", "text/x-setext");
        mapMimeType.put("evm", "x-lml/x-evm");
        mapMimeType.put("evy", "application/x-envoy");
        mapMimeType.put("exe", "application/octet-stream");
        mapMimeType.put("fh4", "image/x-freehand");
        mapMimeType.put("fh5", "image/x-freehand");
        mapMimeType.put("fhc", "image/x-freehand");
        mapMimeType.put("fif", "image/fif");
        mapMimeType.put("fm", "application/x-maker");
        mapMimeType.put("fpx", "image/x-fpx");
        mapMimeType.put("fvi", "video/isivideo");
        mapMimeType.put("gau", "chemical/x-gaussian-input");
        mapMimeType.put("gca", "application/x-gca-compressed");
        mapMimeType.put("gdb", "x-lml/x-gdb");
        mapMimeType.put("gif", "image/gif");
        mapMimeType.put("gps", "application/x-gps");
        mapMimeType.put("gtar", "application/x-gtar");
        mapMimeType.put("gz", "application/x-gzip");
        mapMimeType.put("hdf", "application/x-hdf");
        mapMimeType.put("hdm", "text/x-hdml");
        mapMimeType.put("hdml", "text/x-hdml");
        mapMimeType.put("hlp", "application/winhlp");
        mapMimeType.put("hqx", "application/mac-binhex40");
        mapMimeType.put("htm", "text/html");
        mapMimeType.put("html", "text/html");
        mapMimeType.put("hts", "text/html");
        mapMimeType.put("ice", "x-conference/x-cooltalk");
        mapMimeType.put("ico", "application/octet-stream");
        mapMimeType.put("ief", "image/ief");
        mapMimeType.put("ifm", "image/gif");
        mapMimeType.put("ifs", "image/ifs");
        mapMimeType.put("imy", "audio/melody");
        mapMimeType.put("ins", "application/x-NET-Install");
        mapMimeType.put("ips", "application/x-ipscript");
        mapMimeType.put("ipx", "application/x-ipix");
        mapMimeType.put("it", "audio/x-mod");
        mapMimeType.put("itz", "audio/x-mod");
        mapMimeType.put("ivr", "i-world/i-vrml");
        mapMimeType.put("j2k", "image/j2k");
        mapMimeType.put("jad", "text/vnd.sun.j2me.app-descriptor");
        mapMimeType.put("jam", "application/x-jam");
        mapMimeType.put("jar", "application/java-archive");
        mapMimeType.put("jnlp", "application/x-java-jnlp-file");
        mapMimeType.put("jpe", "image/jpeg");
        mapMimeType.put("jpeg", "image/jpeg");
        mapMimeType.put("jpg", "image/jpeg");
        mapMimeType.put("jpz", "image/jpeg");
        mapMimeType.put("js", "application/x-javascript");
        mapMimeType.put("jwc", "application/jwc");
        mapMimeType.put("kjx", "application/x-kjx");
        mapMimeType.put("lak", "x-lml/x-lak");
        mapMimeType.put("latex", "application/x-latex");
        mapMimeType.put("lcc", "application/fastman");
        mapMimeType.put("lcl", "application/x-digitalloca");
        mapMimeType.put("lcr", "application/x-digitalloca");
        mapMimeType.put("lgh", "application/lgh");
        mapMimeType.put("lha", "application/octet-stream");
        mapMimeType.put("lml", "x-lml/x-lml");
        mapMimeType.put("lmlpack", "x-lml/x-lmlpack");
        mapMimeType.put("lsf", "video/x-ms-asf");
        mapMimeType.put("lsx", "video/x-ms-asf");
        mapMimeType.put("lzh", "application/x-lzh");
        mapMimeType.put("m13", "application/x-msmediaview");
        mapMimeType.put("m14", "application/x-msmediaview");
        mapMimeType.put("m15", "audio/x-mod");
        mapMimeType.put("m3u", "audio/x-mpegurl");
        mapMimeType.put("m3url", "audio/x-mpegurl");
        mapMimeType.put("ma1", "audio/ma1");
        mapMimeType.put("ma2", "audio/ma2");
        mapMimeType.put("ma3", "audio/ma3");
        mapMimeType.put("ma5", "audio/ma5");
        mapMimeType.put("man", "application/x-troff-man");
        mapMimeType.put("map", "magnus-internal/imagemap");
        mapMimeType.put("mbd", "application/mbedlet");
        mapMimeType.put("mct", "application/x-mascot");
        mapMimeType.put("mdb", "application/x-msaccess");
        mapMimeType.put("mdz", "audio/x-mod");
        mapMimeType.put("me", "application/x-troff-me");
        mapMimeType.put("mel", "text/x-vmel");
        mapMimeType.put("mi", "application/x-mif");
        mapMimeType.put("mid", "audio/midi");
        mapMimeType.put("midi", "audio/midi");
        mapMimeType.put("mif", "application/x-mif");
        mapMimeType.put("mil", "image/x-cals");
        mapMimeType.put("mio", "audio/x-mio");
        mapMimeType.put("mmf", "application/x-skt-lbs");
        mapMimeType.put("mng", "video/x-mng");
        mapMimeType.put("mny", "application/x-msmoney");
        mapMimeType.put("moc", "application/x-mocha");
        mapMimeType.put("mocha", "application/x-mocha");
        mapMimeType.put("mod", "audio/x-mod");
        mapMimeType.put("mof", "application/x-yumekara");
        mapMimeType.put("mol", "chemical/x-mdl-molfile");
        mapMimeType.put("mop", "chemical/x-mopac-input");
        mapMimeType.put("mov", "video/quicktime");
        mapMimeType.put("movie", "video/x-sgi-movie");
        mapMimeType.put("mp2", "audio/x-mpeg");
        mapMimeType.put("mp3", "audio/x-mpeg");
        mapMimeType.put("mp4", "video/mp4");
        mapMimeType.put("mpc", "application/vnd.mpohun.certificate");
        mapMimeType.put("mpe", "video/mpeg");
        mapMimeType.put("mpeg", "video/mpeg");
        mapMimeType.put("mpg", "video/mpeg");
        mapMimeType.put("mpg4", "video/mp4");
        mapMimeType.put("mpga", "audio/mpeg");
        mapMimeType.put("mpn", "application/vnd.mophun.application");
        mapMimeType.put("mpp", "application/vnd.ms-project");
        mapMimeType.put("mps", "application/x-mapserver");
        mapMimeType.put("mrl", "text/x-mrml");
        mapMimeType.put("mrm", "application/x-mrm");
        mapMimeType.put("ms", "application/x-troff-ms");
        mapMimeType.put("mts", "application/metastream");
        mapMimeType.put("mtx", "application/metastream");
        mapMimeType.put("mtz", "application/metastream");
        mapMimeType.put("mzv", "application/metastream");
        mapMimeType.put("nar", "application/zip");
        mapMimeType.put("nbmp", "image/nbmp");
        mapMimeType.put("nc", "application/x-netcdf");
        mapMimeType.put("ndb", "x-lml/x-ndb");
        mapMimeType.put("ndwn", "application/ndwn");
        mapMimeType.put("nif", "application/x-nif");
        mapMimeType.put("nmz", "application/x-scream");
        mapMimeType.put("nokia-op-logo", "image/vnd.nok-oplogo-color");
        mapMimeType.put("npx", "application/x-netfpx");
        mapMimeType.put("nsnd", "audio/nsnd");
        mapMimeType.put("nva", "application/x-neva1");
        mapMimeType.put("oda", "application/oda");
        mapMimeType.put("oom", "application/x-AtlasMate-Plugin");
        mapMimeType.put("pac", "audio/x-pac");
        mapMimeType.put("pae", "audio/x-epac");
        mapMimeType.put("pan", "application/x-pan");
        mapMimeType.put("pbm", "image/x-portable-bitmap");
        mapMimeType.put("pcx", "image/x-pcx");
        mapMimeType.put("pda", "image/x-pda");
        mapMimeType.put("pdb", "chemical/x-pdb");
        mapMimeType.put("pdf", "application/pdf");
        mapMimeType.put("pfr", "application/font-tdpfr");
        mapMimeType.put("pgm", "image/x-portable-graymap");
        mapMimeType.put("pict", "image/x-pict");
        mapMimeType.put("pm", "application/x-perl");
        mapMimeType.put("pmd", "application/x-pmd");
        mapMimeType.put("png", "image/png");
        mapMimeType.put("pnm", "image/x-portable-anymap");
        mapMimeType.put("pnz", "image/png");
        mapMimeType.put("pot", "application/vnd.ms-powerpoint");
        mapMimeType.put("ppm", "image/x-portable-pixmap");
        mapMimeType.put("pps", "application/vnd.ms-powerpoint");
        mapMimeType.put("ppt", "application/vnd.ms-powerpoint");
        mapMimeType.put("pptx", "application/vnd.ms-powerpoint");
        mapMimeType.put("pqf", "application/x-cprplayer");
        mapMimeType.put("pqi", "application/cprplayer");
        mapMimeType.put("prc", "application/x-prc");
        mapMimeType.put("proxy", "application/x-ns-proxy-autoconfig");
        mapMimeType.put("ps", "application/postscript");
        mapMimeType.put("ptlk", "application/listenup");
        mapMimeType.put("pub", "application/x-mspublisher");
        mapMimeType.put("pvx", "video/x-pv-pvx");
        mapMimeType.put("qcp", "audio/vnd.qcelp");
        mapMimeType.put("qt", "video/quicktime");
        mapMimeType.put("qti", "image/x-quicktime");
        mapMimeType.put("qtif", "image/x-quicktime");
        mapMimeType.put("r3t", "text/vnd.rn-realtext3d");
        mapMimeType.put("ra", "audio/x-pn-realaudio");
        mapMimeType.put("ram", "audio/x-pn-realaudio");
        mapMimeType.put("rar", "application/x-rar-compressed");
        mapMimeType.put("ras", "image/x-cmu-raster");
        mapMimeType.put("rdf", "application/rdf+xml");
        mapMimeType.put("rf", "image/vnd.rn-realflash");
        mapMimeType.put("rgb", "image/x-rgb");
        mapMimeType.put("rlf", "application/x-richlink");
        mapMimeType.put("rm", "audio/x-pn-realaudio");
        mapMimeType.put("rmf", "audio/x-rmf");
        mapMimeType.put("rmm", "audio/x-pn-realaudio");
        mapMimeType.put("rmvb", "audio/x-pn-realaudio");
        mapMimeType.put("rnx", "application/vnd.rn-realplayer");
        mapMimeType.put("roff", "application/x-troff");
        mapMimeType.put("rp", "image/vnd.rn-realpix");
        mapMimeType.put("rpm", "audio/x-pn-realaudio-plugin");
        mapMimeType.put("rt", "text/vnd.rn-realtext");
        mapMimeType.put("rte", "x-lml/x-gps");
        mapMimeType.put("rtf", "application/rtf");
        mapMimeType.put("rtg", "application/metastream");
        mapMimeType.put("rtx", "text/richtext");
        mapMimeType.put("rv", "video/vnd.rn-realvideo");
        mapMimeType.put("rwc", "application/x-rogerwilco");
        mapMimeType.put("s3m", "audio/x-mod");
        mapMimeType.put("s3z", "audio/x-mod");
        mapMimeType.put("sca", "application/x-supercard");
        mapMimeType.put("scd", "application/x-msschedule");
        mapMimeType.put("sdf", "application/e-score");
        mapMimeType.put("sea", "application/x-stuffit");
        mapMimeType.put("sgm", "text/x-sgml");
        mapMimeType.put("sgml", "text/x-sgml");
        mapMimeType.put("sh", "application/x-sh");
        mapMimeType.put("shar", "application/x-shar");
        mapMimeType.put("shtml", "magnus-internal/parsed-html");
        mapMimeType.put("shw", "application/presentations");
        mapMimeType.put("si6", "image/si6");
        mapMimeType.put("si7", "image/vnd.stiwap.sis");
        mapMimeType.put("si9", "image/vnd.lgtwap.sis");
        mapMimeType.put("sis", "application/vnd.symbian.install");
        mapMimeType.put("sit", "application/x-stuffit");
        mapMimeType.put("skd", "application/x-Koan");
        mapMimeType.put("skm", "application/x-Koan");
        mapMimeType.put("skp", "application/x-Koan");
        mapMimeType.put("skt", "application/x-Koan");
        mapMimeType.put("slc", "application/x-salsa");
        mapMimeType.put("smd", "audio/x-smd");
        mapMimeType.put("smi", "application/smil");
        mapMimeType.put("smil", "application/smil");
        mapMimeType.put("smp", "application/studiom");
        mapMimeType.put("smz", "audio/x-smd");
        mapMimeType.put("snd", "audio/basic");
        mapMimeType.put("spc", "text/x-speech");
        mapMimeType.put("spl", "application/futuresplash");
        mapMimeType.put("spr", "application/x-sprite");
        mapMimeType.put("sprite", "application/x-sprite");
        mapMimeType.put("spt", "application/x-spt");
        mapMimeType.put("src", "application/x-wais-source");
        mapMimeType.put("stk", "application/hyperstudio");
        mapMimeType.put("stm", "audio/x-mod");
        mapMimeType.put("sv4cpio", "application/x-sv4cpio");
        mapMimeType.put("sv4crc", "application/x-sv4crc");
        mapMimeType.put("svf", "image/vnd");
        mapMimeType.put("svg", "image/svg-xml");
        mapMimeType.put("svh", "image/svh");
        mapMimeType.put("svr", "x-world/x-svr");
        mapMimeType.put("swf", "application/x-shockwave-flash");
        mapMimeType.put("swfl", "application/x-shockwave-flash");
        mapMimeType.put("t", "application/x-troff");
        mapMimeType.put("tad", "application/octet-stream");
        mapMimeType.put("talk", "text/x-speech");
        mapMimeType.put("tar", "application/x-tar");
        mapMimeType.put("taz", "application/x-tar");
        mapMimeType.put("tbp", "application/x-timbuktu");
        mapMimeType.put("tbt", "application/x-timbuktu");
        mapMimeType.put("tcl", "application/x-tcl");
        mapMimeType.put("tex", "application/x-tex");
        mapMimeType.put("texi", "application/x-texinfo");
        mapMimeType.put("texinfo", "application/x-texinfo");
        mapMimeType.put("tgz", "application/x-tar");
        mapMimeType.put("thm", "application/vnd.eri.thm");
        mapMimeType.put("tif", "image/tiff");
        mapMimeType.put("tiff", "image/tiff");
        mapMimeType.put("tki", "application/x-tkined");
        mapMimeType.put("tkined", "application/x-tkined");
        mapMimeType.put("toc", "application/toc");
        mapMimeType.put("toy", "image/toy");
        mapMimeType.put("tr", "application/x-troff");
        mapMimeType.put("trk", "x-lml/x-gps");
        mapMimeType.put("trm", "application/x-msterminal");
        mapMimeType.put("tsi", "audio/tsplayer");
        mapMimeType.put("tsp", "application/dsptype");
        mapMimeType.put("tsv", "text/tab-separated-values");
        mapMimeType.put("tsv", "text/tab-separated-values");
        mapMimeType.put("ttf", "application/octet-stream");
        mapMimeType.put("ttz", "application/t-time");
        mapMimeType.put("txt", "text/plain");
        mapMimeType.put("ult", "audio/x-mod");
        mapMimeType.put("ustar", "application/x-ustar");
        mapMimeType.put("uu", "application/x-uuencode");
        mapMimeType.put("uue", "application/x-uuencode");
        mapMimeType.put("vcd", "application/x-cdlink");
        mapMimeType.put("vcf", "text/x-vcard");
        mapMimeType.put("vdo", "video/vdo");
        mapMimeType.put("vib", "audio/vib");
        mapMimeType.put("viv", "video/vivo");
        mapMimeType.put("vivo", "video/vivo");
        mapMimeType.put("vmd", "application/vocaltec-media-desc");
        mapMimeType.put("vmf", "application/vocaltec-media-file");
        mapMimeType.put("vmi", "application/x-dreamcast-vms-info");
        mapMimeType.put("vms", "application/x-dreamcast-vms");
        mapMimeType.put("vox", "audio/voxware");
        mapMimeType.put("vqe", "audio/x-twinvq-plugin");
        mapMimeType.put("vqf", "audio/x-twinvq");
        mapMimeType.put("vql", "audio/x-twinvq");
        mapMimeType.put("vre", "x-world/x-vream");
        mapMimeType.put("vrml", "x-world/x-vrml");
        mapMimeType.put("vrt", "x-world/x-vrt");
        mapMimeType.put("vrw", "x-world/x-vream");
        mapMimeType.put("vts", "workbook/formulaone");
        mapMimeType.put("wav", "audio/x-wav");
        mapMimeType.put("wax", "audio/x-ms-wax");
        mapMimeType.put("wbmp", "image/vnd.wap.wbmp");
        mapMimeType.put("web", "application/vnd.xara");
        mapMimeType.put("wi", "image/wavelet");
        mapMimeType.put("wis", "application/x-InstallShield");
        mapMimeType.put("wm", "video/x-ms-wm");
        mapMimeType.put("wma", "audio/x-ms-wma");
        mapMimeType.put("wmd", "application/x-ms-wmd");
        mapMimeType.put("wmf", "application/x-msmetafile");
        mapMimeType.put("wml", "text/vnd.wap.wml");
        mapMimeType.put("wmlc", "application/vnd.wap.wmlc");
        mapMimeType.put("wmls", "text/vnd.wap.wmlscript");
        mapMimeType.put("wmlsc", "application/vnd.wap.wmlscriptc");
        mapMimeType.put("wmlscript", "text/vnd.wap.wmlscript");
        mapMimeType.put("wmv", "audio/x-ms-wmv");
        mapMimeType.put("wmx", "video/x-ms-wmx");
        mapMimeType.put("wmz", "application/x-ms-wmz");
        mapMimeType.put("wpng", "image/x-up-wpng");
        mapMimeType.put("wpt", "x-lml/x-gps");
        mapMimeType.put("wri", "application/x-mswrite");
        mapMimeType.put("wrl", "x-world/x-vrml");
        mapMimeType.put("wrz", "x-world/x-vrml");
        mapMimeType.put("ws", "text/vnd.wap.wmlscript");
        mapMimeType.put("wsc", "application/vnd.wap.wmlscriptc");
        mapMimeType.put("wv", "video/wavelet");
        mapMimeType.put("wvx", "video/x-ms-wvx");
        mapMimeType.put("wxl", "application/x-wxl");
        mapMimeType.put("x-gzip", "application/x-gzip");
        mapMimeType.put("xar", "application/vnd.xara");
        mapMimeType.put("xbm", "image/x-xbitmap");
        mapMimeType.put("xdm", "application/x-xdma");
        mapMimeType.put("xdma", "application/x-xdma");
        mapMimeType.put("xdw", "application/vnd.fujixerox.docuworks");
        mapMimeType.put("xht", "application/xhtml+xml");
        mapMimeType.put("xhtm", "application/xhtml+xml");
        mapMimeType.put("xhtml", "application/xhtml+xml");
        mapMimeType.put("xla", "application/vnd.ms-excel");
        mapMimeType.put("xlc", "application/vnd.ms-excel");
        mapMimeType.put("xll", "application/x-excel");
        mapMimeType.put("xlm", "application/vnd.ms-excel");
        mapMimeType.put("xls", "application/vnd.ms-excel");
        mapMimeType.put("xlsx", "application/vnd.ms-excel");
        mapMimeType.put("xlt", "application/vnd.ms-excel");
        mapMimeType.put("xlw", "application/vnd.ms-excel");
        mapMimeType.put("xm", "audio/x-mod");
        mapMimeType.put("xml", "text/xml");
        mapMimeType.put("xmz", "audio/x-mod");
        mapMimeType.put("xpi", "application/x-xpinstall");
        mapMimeType.put("xpm", "image/x-xpixmap");
        mapMimeType.put("xsit", "text/xml");
        mapMimeType.put("xsl", "text/xml");
        mapMimeType.put("xul", "text/xul");
        mapMimeType.put("xwd", "image/x-xwindowdump");
        mapMimeType.put("xyz", "chemical/x-pdb");
        mapMimeType.put("yz1", "application/x-yz1");
        mapMimeType.put("z", "application/x-compress");
        mapMimeType.put("zac", "application/x-zaurus-zac");
        mapMimeType.put("zip", "application/zip");
    }

}

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×