String contentType;
Path path = Paths.get(fileFullPath);//fileFullPath为文件路径(String)
contentType = Files.probeContentType(path);
response.setContentType(contentType);
response.setHeader("Content-Disposition", "inline; filename=" + urlEncodedFileName);
上面是nio包提供的方法
或者根据文件扩展名获取,这样没牵扯到 IO效率可能会高一点
public class HttpUtil {
private static Map<String , String> contentTypeMap = new HashMap<>();
public static String getContentType(String fileName) {//也可以是文件路径
String contentType = "application/octet-stream"; //不知道的类型
if (fileName.lastIndexOf(".") < 0) //获取不到扩展名
return contentType;
fileName = fileName.toLowerCase();
String ext = fileName.substring(fileName.lastIndexOf("."));
return contentTypeMap.get(ext);
}
static {
contentTypeMap.put(".aac" , "audio/mp4");
contentTypeMap.put(".load" , "text/html");
contentTypeMap.put(".123" , "application/vnd.lotus-1-2-3");
contentTypeMap.put(".3ds" , "image/x-3ds");
contentTypeMap.put(".3g2" , "video/3gpp");
contentTypeMap.put(".3ga" , "video/3gpp");
contentTypeMap.put(".3gp" , "video/3gpp");
contentTypeMap.put(".3gpp" , "video/3gpp");
contentTypeMap.put(".602" , "application/x-t602");
contentTypeMap.put(".669" , "audio/x-mod");
contentTypeMap.put(".7z" , "application/x-7z-compressed");
contentTypeMap.put(".a" , "application/x-archive");
contentTypeMap.put(".abw" , "application/x-abiword");
contentTypeMap.put(".abw.crashed" , "application/x-abiword");
contentTypeMap.put(".abw.gz" , "application/x-abiword");
contentTypeMap.put(".ac3" , "audio/ac3");
contentTypeMap.put(".ace" , "application/x-ace");
contentTypeMap.put(".adb" , "text/x-adasrc");
contentTypeMap.put(".ads" , "text/x-adasrc");
contentTypeMap.put(".afm" , "application/x-font-afm");
contentTypeMap.put(".ag" , "image/x-applix-graphics");
contentTypeMap.put(".ai" , "application/illustrator");
contentTypeMap.put(".aif" , "audio/x-aiff");
contentTypeMap.put(".aifc" , "audio/x-aiff");
contentTypeMap.put(".aiff" , "audio/x-aiff");
contentTypeMap.put(".al" , "application/x-perl");
contentTypeMap.put(".alz" , "application/x-alz");
contentTypeMap.put(".amr" , "audio/amr");
contentTypeMap.put(".ani" , "application/x-navi-animation");
contentTypeMap.put(".anim[1-9j]" , "video/x-anim");
contentTypeMap.put(".anx" , "application/annodex");
contentTypeMap.put(".ape" , "audio/x-ape");
contentTypeMap.put(".arj" , "application/x-arj");
contentTypeMap.put(".arw" , "image/x-sony-arw");
contentTypeMap.put(".as" , "application/x-applix-spreadsheet");
contentTypeMap.put(".asc" , "text/plain");
contentTypeMap.put(".asf" , "video/x-ms-asf");
contentTypeMap.put(".asp" , "application/x-asp");
contentTypeMap.put(".ass" , "text/x-ssa");
contentTypeMap.put(".asx" , "audio/x-ms-asx");
contentTypeMap.put(".atom" , "application/atom+xml");
contentTypeMap.put(".au" , "audio/basic");
contentTypeMap.put(".avi" , "video/x-msvideo");
contentTypeMap.put(".aw" , "application/x-applix-word");
contentTypeMap.put(".awb" , "audio/amr-wb");
contentTypeMap.put(".awk" , "application/x-awk");
contentTypeMap.put(".axa" , "audio/annodex");
contentTypeMap.put(".axv" , "video/annodex");
contentTypeMap.put(".bak" , "application/x-trash");
contentTypeMap.put(".bcpio" , "application/x-bcpio");
contentTypeMap.put(".bdf" , "application/x-font-bdf");
contentTypeMap.put(".bib" , "text/x-bibtex");
contentTypeMap.put(".bin" , "application/octet-stream");
contentTypeMap.put(".blend" , "application/x-blender");
contentTypeMap.put(".blender" , "application/x-blender");
contentTypeMap.put(".bmp" , "image/bmp");
contentTypeMap.put(".bz" , "application/x-bzip");
contentTypeMap.put(".bz2" , "application/x-bzip");
contentTypeMap.put(".c" , "text/x-csrc");
contentTypeMap.put(".c++" , "text/x-c++src");
contentTypeMap.put(".cab" , "application/vnd.ms-cab-compressed");
contentTypeMap.put(".cb7" , "application/x-cb7");
contentTypeMap.put(".cbr" , "application/x-cbr");
contentTypeMap.put(".cbt" , "application/x-cbt");
contentTypeMap.put(".cbz" , "application/x-cbz");
contentTypeMap.put(".cc" , "text/x-c++src");
contentTypeMap.put(".cdf" , "application/x-netcdf");
contentTypeMap.put(".cdr" , "application/vnd.corel-draw");
contentTypeMap.put(".cer" , "application/x-x509-ca-cert");
contentTypeMap.put(".cert" , "application/x-x509-ca-cert");
contentTypeMap.put(".cgm" , "image/cgm");
contentTypeMap.put(".chm" , "application/x-chm");
contentTypeMap.put(".chrt" , "application/x-kchart");
contentTypeMap.put(".class" , "application/x-java");
contentTypeMap.put(".cls" , "text/x-tex");
contentTypeMap.put(".cmake" , "text/x-cmake");
contentTypeMap.put(".cpio" , "application/x-cpio");
contentTypeMap.put(".cpio.gz" , "application/x-cpio-compressed");
contentTypeMap.put(".cpp" , "text/x-c++src");
contentTypeMap.put(".cr2" , "image/x-canon-cr2");
contentTypeMap.put(".crt" , "application/x-x509-ca-cert");
contentTypeMap.put(".crw" , "image/x-canon-crw");
contentTypeMap.put(".cs" , "text/x-csharp");
contentTypeMap.put(".csh" , "application/x-csh");
contentTypeMap.put(".css" , "text/css");
contentTypeMap.put(".cssl" , "text/css");
contentTypeMap.put(".csv" , "text/csv");
contentTypeMap.put(".cue" , "application/x-cue");
contentTypeMap.put(".cur" , "image/x-win-bitmap");
contentTypeMap.put(".cxx" , "text/x-c++src");
contentTypeMap.put(".d" , "text/x-dsrc");
contentTypeMap.put(".dar" , "application/x-dar");
contentTypeMap.put(".dbf" , "application/x-dbf");
contentTypeMap.put(".dc" , "application/x-dc-rom");
contentTypeMap.put(".dcl" , "text/x-dcl");
contentTypeMap.put(".dcm" , "application/dicom");
contentTypeMap.put(".dcr" , "image/x-kodak-dcr");
contentTypeMap.put(".dds" , "image/x-dds");
contentTypeMap.put(".deb" , "application/x-deb");
contentTypeMap.put(".der" , "application/x-x509-ca-cert");
contentTypeMap.put(".desktop" , "application/x-desktop");
contentTypeMap.put(".dia" , "application/x-dia-diagram");
contentTypeMap.put(".diff" , "text/x-patch");
contentTypeMap.put(".divx" , "video/x-msvideo");
contentTypeMap.put(".djv" , "image/vnd.djvu");
contentTypeMap.put(".djvu" , "image/vnd.djvu");
contentTypeMap.put(".dng" , "image/x-adobe-dng");
contentTypeMap.put(".doc" , "application/msword");
contentTypeMap.put(".docbook" , "application/docbook+xml");
contentTypeMap.put(".docm" , "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
contentTypeMap.put(".docx" , "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
contentTypeMap.put(".dot" , "text/vnd.graphviz");
contentTypeMap.put(".dsl" , "text/x-dsl");
contentTypeMap.put(".dtd" , "application/xml-dtd");
contentTypeMap.put(".dtx" , "text/x-tex");
contentTypeMap.put(".dv" , "video/dv");
contentTypeMap.put(".dvi" , "application/x-dvi");
contentTypeMap.put(".dvi.bz2" , "application/x-bzdvi");
contentTypeMap.put(".dvi.gz" , "application/x-gzdvi");
contentTypeMap.put(".dwg" , "image/vnd.dwg");
contentTypeMap.put(".dxf" , "image/vnd.dxf");
contentTypeMap.put(".e" , "text/x-eiffel");
contentTypeMap.put(".egon" , "application/x-egon");
contentTypeMap.put(".eif" , "text/x-eiffel");
contentTypeMap.put(".el" , "text/x-emacs-lisp");
contentTypeMap.put(".emf" , "image/x-emf");
contentTypeMap.put(".emp" , "application/vnd.emusic-emusic_package");
contentTypeMap.put(".ent" , "application/xml-external-parsed-entity");
contentTypeMap.put(".eps" , "image/x-eps");
contentTypeMap.put(".eps.bz2" , "image/x-bzeps");
contentTypeMap.put(".eps.gz" , "image/x-gzeps");
contentTypeMap.put(".epsf" , "image/x-eps");
contentTypeMap.put(".epsf.bz2" , "image/x-bzeps");
contentTypeMap.put(".epsf.gz" , "image/x-gzeps");
contentTypeMap.put(".epsi" , "image/x-eps");
contentTypeMap.put(".epsi.bz2" , "image/x-bzeps");
contentTypeMap.put(".epsi.gz" , "image/x-gzeps");
contentTypeMap.put(".epub" , "application/epub+zip");
contentTypeMap.put(".erl" , "text/x-erlang");
contentTypeMap.put(".es" , "application/ecmascript");
contentTypeMap.put(".etheme" , "application/x-e-theme");
contentTypeMap.put(".etx" , "text/x-setext");
contentTypeMap.put(".exe" , "application/x-ms-dos-executable");
contentTypeMap.put(".exr" , "image/x-exr");
contentTypeMap.put(".ez" , "application/andrew-inset");
contentTypeMap.put(".f" , "text/x-fortran");
contentTypeMap.put(".f90" , "text/x-fortran");
contentTypeMap.put(".f95" , "text/x-fortran");
contentTypeMap.put(".fb2" , "application/x-fictionbook+xml");
contentTypeMap.put(".fig" , "image/x-xfig");
contentTypeMap.put(".fits" , "image/fits");
contentTypeMap.put(".fl" , "application/x-fluid");
contentTypeMap.put(".flac" , "audio/x-flac");
contentTypeMap.put(".flc" , "video/x-flic");
contentTypeMap.put(".fli" , "video/x-flic");
contentTypeMap.put(".flv" , "video/x-flv");
contentTypeMap.put(".flw" , "application/x-kivio");
contentTypeMap.put(".fo" , "text/x-xslfo");
contentTypeMap.put(".for" , "text/x-fortran");
contentTypeMap.put(".g3" , "image/fax-g3");
contentTypeMap.put(".gb" , "application/x-gameboy-rom");
contentTypeMap.put(".gba" , "application/x-gba-rom");
contentTypeMap.put(".gcrd" , "text/directory");
contentTypeMap.put(".ged" , "application/x-gedcom");
contentTypeMap.put(".gedcom" , "application/x-gedcom");
contentTypeMap.put(".gen" , "application/x-genesis-rom");
contentTypeMap.put(".gf" , "application/x-tex-gf");
contentTypeMap.put(".gg" , "application/x-sms-rom");
contentTypeMap.put(".gif" , "image/gif");
contentTypeMap.put(".glade" , "application/x-glade");
contentTypeMap.put(".gmo" , "application/x-gettext-translation");
contentTypeMap.put(".gnc" , "application/x-gnucash");
contentTypeMap.put(".gnd" , "application/gnunet-directory");
contentTypeMap.put(".gnucash" , "application/x-gnucash");
contentTypeMap.put(".gnumeric" , "application/x-gnumeric");
contentTypeMap.put(".gnuplot" , "application/x-gnuplot");
contentTypeMap.put(".gp" , "application/x-gnuplot");
contentTypeMap.put(".gpg" , "application/pgp-encrypted");
contentTypeMap.put(".gplt" , "application/x-gnuplot");
contentTypeMap.put(".gra" , "application/x-graphite");
contentTypeMap.put(".gsf" , "application/x-font-type1");
contentTypeMap.put(".gsm" , "audio/x-gsm");
contentTypeMap.put(".gtar" , "application/x-tar");
contentTypeMap.put(".gv" , "text/vnd.graphviz");
contentTypeMap.put(".gvp" , "text/x-google-video-pointer");
contentTypeMap.put(".gz" , "application/x-gzip");
contentTypeMap.put(".h" , "text/x-chdr");
contentTypeMap.put(".h++" , "text/x-c++hdr");
contentTypeMap.put(".hdf" , "application/x-hdf");
contentTypeMap.put(".hh" , "text/x-c++hdr");
contentTypeMap.put(".hp" , "text/x-c++hdr");
contentTypeMap.put(".hpgl" , "application/vnd.hp-hpgl");
contentTypeMap.put(".hpp" , "text/x-c++hdr");
contentTypeMap.put(".hs" , "text/x-haskell");
contentTypeMap.put(".htm" , "text/html");
contentTypeMap.put(".html" , "text/html");
contentTypeMap.put(".hwp" , "application/x-hwp");
contentTypeMap.put(".hwt" , "application/x-hwt");
contentTypeMap.put(".hxx" , "text/x-c++hdr");
contentTypeMap.put(".ica" , "application/x-ica");
contentTypeMap.put(".icb" , "image/x-tga");
contentTypeMap.put(".icns" , "image/x-icns");
contentTypeMap.put(".ico" , "image/vnd.microsoft.icon");
contentTypeMap.put(".ics" , "text/calendar");
contentTypeMap.put(".idl" , "text/x-idl");
contentTypeMap.put(".ief" , "image/ief");
contentTypeMap.put(".iff" , "image/x-iff");
contentTypeMap.put(".ilbm" , "image/x-ilbm");
contentTypeMap.put(".ime" , "text/x-imelody");
contentTypeMap.put(".imy" , "text/x-imelody");
contentTypeMap.put(".ins" , "text/x-tex");
contentTypeMap.put(".iptables" , "text/x-iptables");
contentTypeMap.put(".iso" , "application/x-cd-image");
contentTypeMap.put(".iso9660" , "application/x-cd-image");
contentTypeMap.put(".it" , "audio/x-it");
contentTypeMap.put(".j2k" , "image/jp2");
contentTypeMap.put(".jad" , "text/vnd.sun.j2me.app-descriptor");
contentTypeMap.put(".jar" , "application/x-java-archive");
contentTypeMap.put(".java" , "text/x-java");
contentTypeMap.put(".jng" , "image/x-jng");
contentTypeMap.put(".jnlp" , "application/x-java-jnlp-file");
contentTypeMap.put(".jp2" , "image/jp2");
contentTypeMap.put(".jpc" , "image/jp2");
contentTypeMap.put(".jpe" , "image/jpeg");
contentTypeMap.put(".jpeg" , "image/jpeg");
contentTypeMap.put(".jpf" , "image/jp2");
contentTypeMap.put(".jpg" , "image/jpeg");
contentTypeMap.put(".jpr" , "application/x-jbuilder-project");
contentTypeMap.put(".jpx" , "image/jp2");
contentTypeMap.put(".js" , "application/javascript");
contentTypeMap.put(".json" , "application/json");
contentTypeMap.put(".jsonp" , "application/jsonp");
contentTypeMap.put(".k25" , "image/x-kodak-k25");
contentTypeMap.put(".kar" , "audio/midi");
contentTypeMap.put(".karbon" , "application/x-karbon");
contentTypeMap.put(".kdc" , "image/x-kodak-kdc");
contentTypeMap.put(".kdelnk" , "application/x-desktop");
contentTypeMap.put(".kexi" , "application/x-kexiproject-sqlite3");
contentTypeMap.put(".kexic" , "application/x-kexi-connectiondata");
contentTypeMap.put(".kexis" , "application/x-kexiproject-shortcut");
contentTypeMap.put(".kfo" , "application/x-kformula");
contentTypeMap.put(".kil" , "application/x-killustrator");
contentTypeMap.put(".kino" , "application/smil");
contentTypeMap.put(".kml" , "application/vnd.google-earth.kml+xml");
contentTypeMap.put(".kmz" , "application/vnd.google-earth.kmz");
contentTypeMap.put(".kon" , "application/x-kontour");
contentTypeMap.put(".kpm" , "application/x-kpovmodeler");
contentTypeMap.put(".kpr" , "application/x-kpresenter");
contentTypeMap.put(".kpt" , "application/x-kpresenter");
contentTypeMap.put(".kra" , "application/x-krita");
contentTypeMap.put(".ksp" , "application/x-kspread");
contentTypeMap.put(".kud" , "application/x-kugar");
contentTypeMap.put(".kwd" , "application/x-kword");
contentTypeMap.put(".kwt" , "application/x-kword");
contentTypeMap.put(".la" , "application/x-shared-library-la");
contentTypeMap.put(".latex" , "text/x-tex");
contentTypeMap.put(".ldif" , "text/x-ldif");
contentTypeMap.put(".lha" , "application/x-lha");
contentTypeMap.put(".lhs" , "text/x-literate-haskell");
contentTypeMap.put(".lhz" , "application/x-lhz");
contentTypeMap.put(".log" , "text/x-log");
contentTypeMap.put(".ltx" , "text/x-tex");
contentTypeMap.put(".lua" , "text/x-lua");
contentTypeMap.put(".lwo" , "image/x-lwo");
contentTypeMap.put(".lwob" , "image/x-lwo");
contentTypeMap.put(".lws" , "image/x-lws");
contentTypeMap.put(".ly" , "text/x-lilypond");
contentTypeMap.put(".lyx" , "application/x-lyx");
contentTypeMap.put(".lz" , "application/x-lzip");
contentTypeMap.put(".lzh" , "application/x-lha");
contentTypeMap.put(".lzma" , "application/x-lzma");
contentTypeMap.put(".lzo" , "application/x-lzop");
contentTypeMap.put(".m" , "text/x-matlab");
contentTypeMap.put(".m15" , "audio/x-mod");
contentTypeMap.put(".m2t" , "video/mpeg");
contentTypeMap.put(".m3u" , "audio/x-mpegurl");
contentTypeMap.put(".m3u8" , "audio/x-mpegurl");
contentTypeMap.put(".m4" , "application/x-m4");
contentTypeMap.put(".m4a" , "audio/mp4");
contentTypeMap.put(".m4b" , "audio/x-m4b");
contentTypeMap.put(".m4v" , "video/mp4");
contentTypeMap.put(".mab" , "application/x-markaby");
contentTypeMap.put(".man" , "application/x-troff-man");
contentTypeMap.put(".mbox" , "application/mbox");
contentTypeMap.put(".md" , "application/x-genesis-rom");
contentTypeMap.put(".mdb" , "application/vnd.ms-access");
contentTypeMap.put(".mdi" , "image/vnd.ms-modi");
contentTypeMap.put(".me" , "text/x-troff-me");
contentTypeMap.put(".med" , "audio/x-mod");
contentTypeMap.put(".metalink" , "application/metalink+xml");
contentTypeMap.put(".mgp" , "application/x-magicpoint");
contentTypeMap.put(".mid" , "audio/midi");
contentTypeMap.put(".midi" , "audio/midi");
contentTypeMap.put(".mif" , "application/x-mif");
contentTypeMap.put(".minipsf" , "audio/x-minipsf");
contentTypeMap.put(".mka" , "audio/x-matroska");
contentTypeMap.put(".mkv" , "video/x-matroska");
contentTypeMap.put(".ml" , "text/x-ocaml");
contentTypeMap.put(".mli" , "text/x-ocaml");
contentTypeMap.put(".mm" , "text/x-troff-mm");
contentTypeMap.put(".mmf" , "application/x-smaf");
contentTypeMap.put(".mml" , "text/mathml");
contentTypeMap.put(".mng" , "video/x-mng");
contentTypeMap.put(".mo" , "application/x-gettext-translation");
contentTypeMap.put(".mo3" , "audio/x-mo3");
contentTypeMap.put(".moc" , "text/x-moc");
contentTypeMap.put(".mod" , "audio/x-mod");
contentTypeMap.put(".mof" , "text/x-mof");
contentTypeMap.put(".moov" , "video/quicktime");
contentTypeMap.put(".mov" , "video/quicktime");
contentTypeMap.put(".movie" , "video/x-sgi-movie");
contentTypeMap.put(".mp+" , "audio/x-musepack");
contentTypeMap.put(".mp2" , "video/mpeg");
contentTypeMap.put(".mp3" , "audio/mpeg");
contentTypeMap.put(".mp4" , "video/mp4");
contentTypeMap.put(".mpc" , "audio/x-musepack");
contentTypeMap.put(".mpe" , "video/mpeg");
contentTypeMap.put(".mpeg" , "video/mpeg");
contentTypeMap.put(".mpg" , "video/mpeg");
contentTypeMap.put(".mpga" , "audio/mpeg");
contentTypeMap.put(".mpp" , "audio/x-musepack");
contentTypeMap.put(".mrl" , "text/x-mrml");
contentTypeMap.put(".mrml" , "text/x-mrml");
contentTypeMap.put(".mrw" , "image/x-minolta-mrw");
contentTypeMap.put(".ms" , "text/x-troff-ms");
contentTypeMap.put(".msi" , "application/x-msi");
contentTypeMap.put(".msod" , "image/x-msod");
contentTypeMap.put(".msx" , "application/x-msx-rom");
contentTypeMap.put(".mtm" , "audio/x-mod");
contentTypeMap.put(".mup" , "text/x-mup");
contentTypeMap.put(".mxf" , "application/mxf");
contentTypeMap.put(".n64" , "application/x-n64-rom");
contentTypeMap.put(".nb" , "application/mathematica");
contentTypeMap.put(".nc" , "application/x-netcdf");
contentTypeMap.put(".nds" , "application/x-nintendo-ds-rom");
contentTypeMap.put(".nef" , "image/x-nikon-nef");
contentTypeMap.put(".nes" , "application/x-nes-rom");
contentTypeMap.put(".nfo" , "text/x-nfo");
contentTypeMap.put(".not" , "text/x-mup");
contentTypeMap.put(".nsc" , "application/x-netshow-channel");
contentTypeMap.put(".nsv" , "video/x-nsv");
contentTypeMap.put(".o" , "application/x-object");
contentTypeMap.put(".obj" , "application/x-tgif");
contentTypeMap.put(".ocl" , "text/x-ocl");
contentTypeMap.put(".oda" , "application/oda");
contentTypeMap.put(".odb" , "application/vnd.oasis.opendocument.database");
contentTypeMap.put(".odc" , "application/vnd.oasis.opendocument.chart");
contentTypeMap.put(".odf" , "application/vnd.oasis.opendocument.formula");
contentTypeMap.put(".odg" , "application/vnd.oasis.opendocument.graphics");
contentTypeMap.put(".odi" , "application/vnd.oasis.opendocument.image");
contentTypeMap.put(".odm" , "application/vnd.oasis.opendocument.text-master");
contentTypeMap.put(".odp" , "application/vnd.oasis.opendocument.presentation");
contentTypeMap.put(".ods" , "application/vnd.oasis.opendocument.spreadsheet");
contentTypeMap.put(".odt" , "application/vnd.oasis.opendocument.text");
contentTypeMap.put(".oga" , "audio/ogg");
contentTypeMap.put(".ogg" , "video/x-theora+ogg");
contentTypeMap.put(".ogm" , "video/x-ogm+ogg");
contentTypeMap.put(".ogv" , "video/ogg");
contentTypeMap.put(".ogx" , "application/ogg");
contentTypeMap.put(".old" , "application/x-trash");
contentTypeMap.put(".oleo" , "application/x-oleo");
contentTypeMap.put(".opml" , "text/x-opml+xml");
contentTypeMap.put(".ora" , "image/openraster");
contentTypeMap.put(".orf" , "image/x-olympus-orf");
contentTypeMap.put(".otc" , "application/vnd.oasis.opendocument.chart-template");
contentTypeMap.put(".otf" , "application/x-font-otf");
contentTypeMap.put(".otg" , "application/vnd.oasis.opendocument.graphics-template");
contentTypeMap.put(".oth" , "application/vnd.oasis.opendocument.text-web");
contentTypeMap.put(".otp" , "application/vnd.oasis.opendocument.presentation-template");
contentTypeMap.put(".ots" , "application/vnd.oasis.opendocument.spreadsheet-template");
contentTypeMap.put(".ott" , "application/vnd.oasis.opendocument.text-template");
contentTypeMap.put(".owl" , "application/rdf+xml");
contentTypeMap.put(".oxt" , "application/vnd.openofficeorg.extension");
contentTypeMap.put(".p" , "text/x-pascal");
contentTypeMap.put(".p10" , "application/pkcs10");
contentTypeMap.put(".p12" , "application/x-pkcs12");
contentTypeMap.put(".p7b" , "application/x-pkcs7-certificates");
contentTypeMap.put(".p7s" , "application/pkcs7-signature");
contentTypeMap.put(".pack" , "application/x-java-pack200");
contentTypeMap.put(".pak" , "application/x-pak");
contentTypeMap.put(".par2" , "application/x-par2");
contentTypeMap.put(".pas" , "text/x-pascal");
contentTypeMap.put(".patch" , "text/x-patch");
contentTypeMap.put(".pbm" , "image/x-portable-bitmap");
contentTypeMap.put(".pcd" , "image/x-photo-cd");
contentTypeMap.put(".pcf" , "application/x-cisco-vpn-settings");
contentTypeMap.put(".pcf.gz" , "application/x-font-pcf");
contentTypeMap.put(".pcf.z" , "application/x-font-pcf");
contentTypeMap.put(".pcl" , "application/vnd.hp-pcl");
contentTypeMap.put(".pcx" , "image/x-pcx");
contentTypeMap.put(".pdb" , "chemical/x-pdb");
contentTypeMap.put(".pdc" , "application/x-aportisdoc");
contentTypeMap.put(".pdf" , "application/pdf");
contentTypeMap.put(".pdf.bz2" , "application/x-bzpdf");
contentTypeMap.put(".pdf.gz" , "application/x-gzpdf");
contentTypeMap.put(".pef" , "image/x-pentax-pef");
contentTypeMap.put(".pem" , "application/x-x509-ca-cert");
contentTypeMap.put(".perl" , "application/x-perl");
contentTypeMap.put(".pfa" , "application/x-font-type1");
contentTypeMap.put(".pfb" , "application/x-font-type1");
contentTypeMap.put(".pfx" , "application/x-pkcs12");
contentTypeMap.put(".pgm" , "image/x-portable-graymap");
contentTypeMap.put(".pgn" , "application/x-chess-pgn");
contentTypeMap.put(".pgp" , "application/pgp-encrypted");
contentTypeMap.put(".php" , "application/x-php");
contentTypeMap.put(".php3" , "application/x-php");
contentTypeMap.put(".php4" , "application/x-php");
contentTypeMap.put(".pict" , "image/x-pict");
contentTypeMap.put(".pict1" , "image/x-pict");
contentTypeMap.put(".pict2" , "image/x-pict");
contentTypeMap.put(".pickle" , "application/python-pickle");
contentTypeMap.put(".pk" , "application/x-tex-pk");
contentTypeMap.put(".pkipath" , "application/pkix-pkipath");
contentTypeMap.put(".pkr" , "application/pgp-keys");
contentTypeMap.put(".pl" , "application/x-perl");
contentTypeMap.put(".pla" , "audio/x-iriver-pla");
contentTypeMap.put(".pln" , "application/x-planperfect");
contentTypeMap.put(".pls" , "audio/x-scpls");
contentTypeMap.put(".pm" , "application/x-perl");
contentTypeMap.put(".png" , "image/png");
contentTypeMap.put(".pnm" , "image/x-portable-anymap");
contentTypeMap.put(".pntg" , "image/x-macpaint");
contentTypeMap.put(".po" , "text/x-gettext-translation");
contentTypeMap.put(".por" , "application/x-spss-por");
contentTypeMap.put(".pot" , "text/x-gettext-translation-template");
contentTypeMap.put(".ppm" , "image/x-portable-pixmap");
contentTypeMap.put(".pps" , "application/vnd.ms-powerpoint");
contentTypeMap.put(".ppt" , "application/vnd.ms-powerpoint");
contentTypeMap.put(".pptm" , "application/vnd.openxmlformats-officedocument.presentationml.presentation");
contentTypeMap.put(".pptx" , "application/vnd.openxmlformats-officedocument.presentationml.presentation");
contentTypeMap.put(".ppz" , "application/vnd.ms-powerpoint");
contentTypeMap.put(".prc" , "application/x-palm-database");
contentTypeMap.put(".ps" , "application/postscript");
contentTypeMap.put(".ps.bz2" , "application/x-bzpostscript");
contentTypeMap.put(".ps.gz" , "application/x-gzpostscript");
contentTypeMap.put(".psd" , "image/vnd.adobe.photoshop");
contentTypeMap.put(".psf" , "audio/x-psf");
contentTypeMap.put(".psf.gz" , "application/x-gz-font-linux-psf");
contentTypeMap.put(".psflib" , "audio/x-psflib");
contentTypeMap.put(".psid" , "audio/prs.sid");
contentTypeMap.put(".psw" , "application/x-pocket-word");
contentTypeMap.put(".pw" , "application/x-pw");
contentTypeMap.put(".py" , "text/x-python");
contentTypeMap.put(".pyc" , "application/x-python-bytecode");
contentTypeMap.put(".pyo" , "application/x-python-bytecode");
contentTypeMap.put(".qif" , "image/x-quicktime");
contentTypeMap.put(".qt" , "video/quicktime");
contentTypeMap.put(".qtif" , "image/x-quicktime");
contentTypeMap.put(".qtl" , "application/x-quicktime-media-link");
contentTypeMap.put(".qtvr" , "video/quicktime");
contentTypeMap.put(".ra" , "audio/vnd.rn-realaudio");
contentTypeMap.put(".raf" , "image/x-fuji-raf");
contentTypeMap.put(".ram" , "application/ram");
contentTypeMap.put(".rar" , "application/x-rar");
contentTypeMap.put(".ras" , "image/x-cmu-raster");
contentTypeMap.put(".raw" , "image/x-panasonic-raw");
contentTypeMap.put(".rax" , "audio/vnd.rn-realaudio");
contentTypeMap.put(".rb" , "application/x-ruby");
contentTypeMap.put(".rdf" , "application/rdf+xml");
contentTypeMap.put(".rdfs" , "application/rdf+xml");
contentTypeMap.put(".reg" , "text/x-ms-regedit");
contentTypeMap.put(".rej" , "application/x-reject");
contentTypeMap.put(".rgb" , "image/x-rgb");
contentTypeMap.put(".rle" , "image/rle");
contentTypeMap.put(".rm" , "application/vnd.rn-realmedia");
contentTypeMap.put(".rmj" , "application/vnd.rn-realmedia");
contentTypeMap.put(".rmm" , "application/vnd.rn-realmedia");
contentTypeMap.put(".rms" , "application/vnd.rn-realmedia");
contentTypeMap.put(".rmvb" , "application/vnd.rn-realmedia");
contentTypeMap.put(".rmx" , "application/vnd.rn-realmedia");
contentTypeMap.put(".roff" , "text/troff");
contentTypeMap.put(".rp" , "image/vnd.rn-realpix");
contentTypeMap.put(".rpm" , "application/x-rpm");
contentTypeMap.put(".rss" , "application/rss+xml");
contentTypeMap.put(".rt" , "text/vnd.rn-realtext");
contentTypeMap.put(".rtf" , "application/rtf");
contentTypeMap.put(".rtx" , "text/richtext");
contentTypeMap.put(".rv" , "video/vnd.rn-realvideo");
contentTypeMap.put(".rvx" , "video/vnd.rn-realvideo");
contentTypeMap.put(".s3m" , "audio/x-s3m");
contentTypeMap.put(".sam" , "application/x-amipro");
contentTypeMap.put(".sami" , "application/x-sami");
contentTypeMap.put(".sav" , "application/x-spss-sav");
contentTypeMap.put(".scm" , "text/x-scheme");
contentTypeMap.put(".sda" , "application/vnd.stardivision.draw");
contentTypeMap.put(".sdc" , "application/vnd.stardivision.calc");
contentTypeMap.put(".sdd" , "application/vnd.stardivision.impress");
contentTypeMap.put(".sdp" , "application/sdp");
contentTypeMap.put(".sds" , "application/vnd.stardivision.chart");
contentTypeMap.put(".sdw" , "application/vnd.stardivision.writer");
contentTypeMap.put(".sgf" , "application/x-go-sgf");
contentTypeMap.put(".sgi" , "image/x-sgi");
contentTypeMap.put(".sgl" , "application/vnd.stardivision.writer");
contentTypeMap.put(".sgm" , "text/sgml");
contentTypeMap.put(".sgml" , "text/sgml");
contentTypeMap.put(".sh" , "application/x-shellscript");
contentTypeMap.put(".shar" , "application/x-shar");
contentTypeMap.put(".shn" , "application/x-shorten");
contentTypeMap.put(".siag" , "application/x-siag");
contentTypeMap.put(".sid" , "audio/prs.sid");
contentTypeMap.put(".sik" , "application/x-trash");
contentTypeMap.put(".sis" , "application/vnd.symbian.install");
contentTypeMap.put(".sisx" , "x-epoc/x-sisx-app");
contentTypeMap.put(".sit" , "application/x-stuffit");
contentTypeMap.put(".siv" , "application/sieve");
contentTypeMap.put(".sk" , "image/x-skencil");
contentTypeMap.put(".sk1" , "image/x-skencil");
contentTypeMap.put(".skr" , "application/pgp-keys");
contentTypeMap.put(".slk" , "text/spreadsheet");
contentTypeMap.put(".smaf" , "application/x-smaf");
contentTypeMap.put(".smc" , "application/x-snes-rom");
contentTypeMap.put(".smd" , "application/vnd.stardivision.mail");
contentTypeMap.put(".smf" , "application/vnd.stardivision.math");
contentTypeMap.put(".smi" , "application/x-sami");
contentTypeMap.put(".smil" , "application/smil");
contentTypeMap.put(".sml" , "application/smil");
contentTypeMap.put(".sms" , "application/x-sms-rom");
contentTypeMap.put(".snd" , "audio/basic");
contentTypeMap.put(".so" , "application/x-sharedlib");
contentTypeMap.put(".spc" , "application/x-pkcs7-certificates");
contentTypeMap.put(".spd" , "application/x-font-speedo");
contentTypeMap.put(".spec" , "text/x-rpm-spec");
contentTypeMap.put(".spl" , "application/x-shockwave-flash");
contentTypeMap.put(".spx" , "audio/x-speex");
contentTypeMap.put(".sql" , "text/x-sql");
contentTypeMap.put(".sr2" , "image/x-sony-sr2");
contentTypeMap.put(".src" , "application/x-wais-source");
contentTypeMap.put(".srf" , "image/x-sony-srf");
contentTypeMap.put(".srt" , "application/x-subrip");
contentTypeMap.put(".ssa" , "text/x-ssa");
contentTypeMap.put(".stc" , "application/vnd.sun.xml.calc.template");
contentTypeMap.put(".std" , "application/vnd.sun.xml.draw.template");
contentTypeMap.put(".sti" , "application/vnd.sun.xml.impress.template");
contentTypeMap.put(".stm" , "audio/x-stm");
contentTypeMap.put(".stw" , "application/vnd.sun.xml.writer.template");
contentTypeMap.put(".sty" , "text/x-tex");
contentTypeMap.put(".sub" , "text/x-subviewer");
contentTypeMap.put(".sun" , "image/x-sun-raster");
contentTypeMap.put(".sv4cpio" , "application/x-sv4cpio");
contentTypeMap.put(".sv4crc" , "application/x-sv4crc");
contentTypeMap.put(".svg" , "image/svg+xml");
contentTypeMap.put(".svgz" , "image/svg+xml-compressed");
contentTypeMap.put(".swf" , "application/x-shockwave-flash");
contentTypeMap.put(".sxc" , "application/vnd.sun.xml.calc");
contentTypeMap.put(".sxd" , "application/vnd.sun.xml.draw");
contentTypeMap.put(".sxg" , "application/vnd.sun.xml.writer.global");
contentTypeMap.put(".sxi" , "application/vnd.sun.xml.impress");
contentTypeMap.put(".sxm" , "application/vnd.sun.xml.math");
contentTypeMap.put(".sxw" , "application/vnd.sun.xml.writer");
contentTypeMap.put(".sylk" , "text/spreadsheet");
contentTypeMap.put(".t" , "text/troff");
contentTypeMap.put(".t2t" , "text/x-txt2tags");
contentTypeMap.put(".tar" , "application/x-tar");
contentTypeMap.put(".tar.bz" , "application/x-bzip-compressed-tar");
contentTypeMap.put(".tar.bz2" , "application/x-bzip-compressed-tar");
contentTypeMap.put(".tar.gz" , "application/x-compressed-tar");
contentTypeMap.put(".tar.lzma" , "application/x-lzma-compressed-tar");
contentTypeMap.put(".tar.lzo" , "application/x-tzo");
contentTypeMap.put(".tar.xz" , "application/x-xz-compressed-tar");
contentTypeMap.put(".tar.z" , "application/x-tarz");
contentTypeMap.put(".tbz" , "application/x-bzip-compressed-tar");
contentTypeMap.put(".tbz2" , "application/x-bzip-compressed-tar");
contentTypeMap.put(".tcl" , "text/x-tcl");
contentTypeMap.put(".tex" , "text/x-tex");
contentTypeMap.put(".texi" , "text/x-texinfo");
contentTypeMap.put(".texinfo" , "text/x-texinfo");
contentTypeMap.put(".tga" , "image/x-tga");
contentTypeMap.put(".tgz" , "application/x-compressed-tar");
contentTypeMap.put(".theme" , "application/x-theme");
contentTypeMap.put(".themepack" , "application/x-windows-themepack");
contentTypeMap.put(".tif" , "image/tiff");
contentTypeMap.put(".tiff" , "image/tiff");
contentTypeMap.put(".tk" , "text/x-tcl");
contentTypeMap.put(".tlz" , "application/x-lzma-compressed-tar");
contentTypeMap.put(".tnef" , "application/vnd.ms-tnef");
contentTypeMap.put(".tnf" , "application/vnd.ms-tnef");
contentTypeMap.put(".toc" , "application/x-cdrdao-toc");
contentTypeMap.put(".torrent" , "application/x-bittorrent");
contentTypeMap.put(".tpic" , "image/x-tga");
contentTypeMap.put(".tr" , "text/troff");
contentTypeMap.put(".ts" , "application/x-linguist");
contentTypeMap.put(".tsv" , "text/tab-separated-values");
contentTypeMap.put(".tta" , "audio/x-tta");
contentTypeMap.put(".ttc" , "application/x-font-ttf");
contentTypeMap.put(".ttf" , "application/x-font-ttf");
contentTypeMap.put(".ttx" , "application/x-font-ttx");
contentTypeMap.put(".txt" , "text/plain");
contentTypeMap.put(".txz" , "application/x-xz-compressed-tar");
contentTypeMap.put(".tzo" , "application/x-tzo");
contentTypeMap.put(".ufraw" , "application/x-ufraw");
contentTypeMap.put(".ui" , "application/x-designer");
contentTypeMap.put(".uil" , "text/x-uil");
contentTypeMap.put(".ult" , "audio/x-mod");
contentTypeMap.put(".uni" , "audio/x-mod");
contentTypeMap.put(".uri" , "text/x-uri");
contentTypeMap.put(".url" , "text/x-uri");
contentTypeMap.put(".ustar" , "application/x-ustar");
contentTypeMap.put(".vala" , "text/x-vala");
contentTypeMap.put(".vapi" , "text/x-vala");
contentTypeMap.put(".vcf" , "text/directory");
contentTypeMap.put(".vcs" , "text/calendar");
contentTypeMap.put(".vct" , "text/directory");
contentTypeMap.put(".vda" , "image/x-tga");
contentTypeMap.put(".vhd" , "text/x-vhdl");
contentTypeMap.put(".vhdl" , "text/x-vhdl");
contentTypeMap.put(".viv" , "video/vivo");
contentTypeMap.put(".vivo" , "video/vivo");
contentTypeMap.put(".vlc" , "audio/x-mpegurl");
contentTypeMap.put(".vob" , "video/mpeg");
contentTypeMap.put(".voc" , "audio/x-voc");
contentTypeMap.put(".vor" , "application/vnd.stardivision.writer");
contentTypeMap.put(".vst" , "image/x-tga");
contentTypeMap.put(".wav" , "audio/x-wav");
contentTypeMap.put(".wax" , "audio/x-ms-asx");
contentTypeMap.put(".wb1" , "application/x-quattropro");
contentTypeMap.put(".wb2" , "application/x-quattropro");
contentTypeMap.put(".wb3" , "application/x-quattropro");
contentTypeMap.put(".wbmp" , "image/vnd.wap.wbmp");
contentTypeMap.put(".wcm" , "application/vnd.ms-works");
contentTypeMap.put(".wdb" , "application/vnd.ms-works");
contentTypeMap.put(".webm" , "video/webm");
contentTypeMap.put(".wk1" , "application/vnd.lotus-1-2-3");
contentTypeMap.put(".wk3" , "application/vnd.lotus-1-2-3");
contentTypeMap.put(".wk4" , "application/vnd.lotus-1-2-3");
contentTypeMap.put(".wks" , "application/vnd.ms-works");
contentTypeMap.put(".wma" , "audio/x-ms-wma");
contentTypeMap.put(".wmf" , "image/x-wmf");
contentTypeMap.put(".wml" , "text/vnd.wap.wml");
contentTypeMap.put(".wmls" , "text/vnd.wap.wmlscript");
contentTypeMap.put(".wmv" , "video/x-ms-wmv");
contentTypeMap.put(".wmx" , "audio/x-ms-asx");
contentTypeMap.put(".wp" , "application/vnd.wordperfect");
contentTypeMap.put(".wp4" , "application/vnd.wordperfect");
contentTypeMap.put(".wp5" , "application/vnd.wordperfect");
contentTypeMap.put(".wp6" , "application/vnd.wordperfect");
contentTypeMap.put(".wpd" , "application/vnd.wordperfect");
contentTypeMap.put(".wpg" , "application/x-wpg");
contentTypeMap.put(".wpl" , "application/vnd.ms-wpl");
contentTypeMap.put(".wpp" , "application/vnd.wordperfect");
contentTypeMap.put(".wps" , "application/vnd.ms-works");
contentTypeMap.put(".wri" , "application/x-mswrite");
contentTypeMap.put(".wrl" , "model/vrml");
contentTypeMap.put(".wv" , "audio/x-wavpack");
contentTypeMap.put(".wvc" , "audio/x-wavpack-correction");
contentTypeMap.put(".wvp" , "audio/x-wavpack");
contentTypeMap.put(".wvx" , "audio/x-ms-asx");
contentTypeMap.put(".x3f" , "image/x-sigma-x3f");
contentTypeMap.put(".xac" , "application/x-gnucash");
contentTypeMap.put(".xbel" , "application/x-xbel");
contentTypeMap.put(".xbl" , "application/xml");
contentTypeMap.put(".xbm" , "image/x-xbitmap");
contentTypeMap.put(".xcf" , "image/x-xcf");
contentTypeMap.put(".xcf.bz2" , "image/x-compressed-xcf");
contentTypeMap.put(".xcf.gz" , "image/x-compressed-xcf");
contentTypeMap.put(".xhtml" , "application/xhtml+xml");
contentTypeMap.put(".xi" , "audio/x-xi");
contentTypeMap.put(".xla" , "application/vnd.ms-excel");
contentTypeMap.put(".xlc" , "application/vnd.ms-excel");
contentTypeMap.put(".xld" , "application/vnd.ms-excel");
contentTypeMap.put(".xlf" , "application/x-xliff");
contentTypeMap.put(".xliff" , "application/x-xliff");
contentTypeMap.put(".xll" , "application/vnd.ms-excel");
contentTypeMap.put(".xlm" , "application/vnd.ms-excel");
contentTypeMap.put(".xls" , "application/vnd.ms-excel");
contentTypeMap.put(".xlsm" , "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
contentTypeMap.put(".xlsx" , "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
contentTypeMap.put(".xlt" , "application/vnd.ms-excel");
contentTypeMap.put(".xlw" , "application/vnd.ms-excel");
contentTypeMap.put(".xsl" , "application/xml");
contentTypeMap.put(".xslfo" , "text/x-xslfo");
contentTypeMap.put(".xslt" , "application/xml");
contentTypeMap.put(".xspf" , "application/xspf+xml");
contentTypeMap.put(".xul" , "application/vnd.mozilla.xul+xml");
contentTypeMap.put(".xwd" , "image/x-xwindowdump");
contentTypeMap.put(".xyz" , "chemical/x-pdb");
contentTypeMap.put(".xz" , "application/x-xz");
contentTypeMap.put(".w2p" , "application/w2p");
contentTypeMap.put(".z" , "application/x-compress");
contentTypeMap.put(".zabw" , "application/x-abiword");
contentTypeMap.put(".zip" , "application/zip");
contentTypeMap.put(".xm" , "audio/x-xm");
contentTypeMap.put(".xmf" , "audio/x-xmf");
contentTypeMap.put(".xmi" , "text/x-xmi");
contentTypeMap.put(".xml" , "application/xml");
contentTypeMap.put(".xpm" , "image/x-xpixmap");
contentTypeMap.put(".xps" , "application/vnd.ms-xpsdocument");
}
}