随笔 - 303  文章 - 883  trackbacks - 0
<2007年3月>
25262728123
45678910
11121314151617
18192021222324
25262728293031
1234567

欢迎光临! 
闲聊 QQ:1074961813

随笔分类(357)

我管理的群

公共blog

  • n维空间
  • Email : java3d@126.com 群 : 12999758

参与管理的论坛

好友的blog

我的其他blog

朋友的网站

搜索

  •  

最新评论

大家好啊我是寻觅

Tomcat在默认情况下下载.rar/.mp3的文件是把文件当作文本文件打开,

导致打开后,不是下载,而是乱码一页,解决方法网上不是很多也

不全面,于是我找了凑在一起弄了这个;


解决方法:

打开conf/web.xml,加入下面的代码.

请大家按需要选择

  1 < mime-mapping >  
  2 < extension > doc </ extension >
  3 < mime-type > application/msword </ mime-type >  
  4 </ mime-mapping >  
  5 < mime-mapping >  
  6 < extension > xls </ extension >  
  7 < mime-type > application/msexcel </ mime-type >  
  8 </ mime-mapping >  
  9 < mime-mapping >  
 10 < extension > pdf </ extension >  
 11 < mime-type > application/pdf </ mime-type >  
 12 </ mime-mapping >
 13 < mime-mapping >  
 14 < extension > zip </ extension >  
 15 < mime-type > application/zip </ mime-type >  
 16 </ mime-mapping >
 17 < mime-mapping >  
 18 < extension > rar </ extension >  
 19 < mime-type > application/rar </ mime-type >  
 20 </ mime-mapping >
 21 < mime-mapping >  
 22 < extension > txt </ extension >  
 23 < mime-type > application/txt </ mime-type >  
 24 </ mime-mapping >
 25 < mime-mapping >  
 26 < extension > chm </ extension >  
 27 < mime-type > application/mshelp </ mime-type >
 28 </ mime-mapping >     
 29 < mime-mapping >
 30 < extension > mht </ extension >
 31 < mime-type > text/x-mht </ mime-type >
 32 </ mime-mapping >
 33 < mime-mapping >
 34 < extension > rar </ extension >
 35 < mime-type > application/octet-stream </ mime-type >
 36 </ mime-mapping >
 37 < mime-mapping >
 38 < extension > iso </ extension >
 39 < mime-type > application/octet-stream </ mime-type >
 40 </ mime-mapping >
 41 < mime-mapping >
 42 < extension > ape </ extension >
 43 < mime-type > application/octet-stream </ mime-type >
 44 </ mime-mapping >
 45 < mime-mapping >
 46 < extension > rmvb </ extension >
 47 < mime-type > application/octet-stream </ mime-type >
 48 </ mime-mapping >
 49 < mime-mapping >
 50 < extension > ico </ extension >
 51 < mime-type > image/x-icon </ mime-type >
 52 </ mime-mapping >
 53 < mime-mapping >
 54 < extension > dsp </ extension >
 55 < mime-type > text/html </ mime-type >
 56 </ mime-mapping >
 57 < mime-mapping >
 58 < extension > gif </ extension >
 59 < mime-type > image/gif </ mime-type >
 60 </ mime-mapping >
 61 < mime-mapping >
 62 < extension > htm </ extension >
 63 < mime-type > text/html </ mime-type >
 64 </ mime-mapping >
 65 < mime-mapping >
 66 < extension > html </ extension >
 67 < mime-type > text/html </ mime-type >
 68 </ mime-mapping >
 69 < mime-mapping >
 70 < extension > jnlp </ extension >
 71 < mime-type > application/x-java-jnlp-file </ mime-type >
 72 </ mime-mapping >
 73 < mime-mapping >
 74 < extension > jpeg </ extension >
 75 < mime-type > image/jpeg </ mime-type >
 76 </ mime-mapping >
 77 < mime-mapping >
 78 < extension > jpg </ extension >
 79 < mime-type > image/jpeg </ mime-type >
 80 </ mime-mapping >
 81 < mime-mapping >
 82 < extension > js </ extension >
 83 < mime-type > application/x-javascript </ mime-type >
 84 </ mime-mapping >
 85 < mime-mapping >
 86 < extension > pdf </ extension >
 87 < mime-type > application/pdf </ mime-type >
 88 </ mime-mapping >
 89 < mime-mapping >
 90 < extension > png </ extension >
 91 < mime-type > image/png </ mime-type >
 92 </ mime-mapping >
 93 < mime-mapping >
 94 < extension > txt </ extension >
 95 < mime-type > text/plain </ mime-type >
 96 </ mime-mapping >
 97 < mime-mapping >
 98 < extension > xls </ extension >
 99 < mime-type > application/vnd.ms-excel </ mime-type >
100 </ mime-mapping >
101 < mime-mapping >
102 < extension > xml </ extension >
103 < mime-type > text/xml </ mime-type >
104 </ mime-mapping >
105 < mime-mapping >
106 < extension > xul </ extension >
107 < mime-type > application/vnd.mozilla.xul-xml </ mime-type >
108 </ mime-mapping >
109 < mime-mapping >
110 < extension > zhtml </ extension >
111 < mime-type > text/html </ mime-type >
112 </ mime-mapping >
113 < mime-mapping >
114 < extension > zip </ extension >
115 < mime-type > application/x-zip </ mime-type >
116 </ mime-mapping >
117 < mime-mapping >
118 < extension > zul </ extension >
119 < mime-type > text/html </ mime-type >
120 </ mime-mapping >
121 < mime-mapping >
122 < extension > foo </ extension >
123 < mime-type > application/x-fubar </ mime-type >
124 </ mime-mapping >
125 < mime-mapping >
126 < extension > ps </ extension >
127 < mime-type > application/postscrīpt </ mime-type >
128 </ mime-mapping >
129
130

其他的,用法和上面一样给个大概:

  1application/astound asd,asn 
  2application/bld bld 
  3application/bld2 bld2 
  4application/cprplayer pqi 
  5application/e-score sdf 
  6application/fastman lcc 
  7application/font-tdpfr pfr 
  8application/futuresplash spl 
  9application/java-archive jar 
 10application/jwc jwc 
 11application/lgh lgh 
 12application/listenup ptlk 
 13application/mac-binhex40 hqx 
 14application/mbedlet mbd 
 15application/metastream mts,mtx,mtz,mzv,rtg, 
 16application/msword doc 
 17application/octet-stream avb, AVB, bin, bpk, class, dmg,exe, tad, TAD, ttf,dll  
 18application/oda oda 
 19application/pdf pdf 
 20application/postscript ai,eps,ps 
 21application/presentations shw 
 22application/rdf+xml rdf 
 23application/rtf rtf 
 24application/smil smi 
 25application/studiom smp 
 26application/timbuktu tbt 
 27application/toc toc 
 28application/t-time ttz 
 29application/vnd.fujixerox.docuworks xdw 
 30application/vnd.lotus-1-2-3 123 
 31application/vnd.ms-excel xls,xlw,xla,xlc,xlm,xlt 
 32application/vnd.ms-powerpoint ppt,pps,pot 
 33application/vnd.ms-project mpp 
 34application/vnd.rn-realplayer rnx 
 35application/vnd.wap.wmlc wmlc 
 36application/winhlp hlp 
 37application/x-asap asp 
 38application/x-AtlasMate-Plugin oom 
 39application/x-authoware-bin aab 
 40application/x-authoware-map aam 
 41application/x-authoware-seg aas 
 42application/x-bzip2 bz2 
 43application/x-cmx cmx 
 44application/x-cnc ccn 
 45application/x-cocoa cco 
 46application/x-cprplayer pqf 
 47application/x-csh csh 
 48application/x-cult3d-object co 丂丂丂 
 49application/x-digitalloca lcr,lcl 
 50application/x-director dcr,dir,dxr 
 51application/x-dot dot 
 52application/x-dreamcast-vms vms 
 53application/x-dreamcast-vms-info vmi 
 54application/x-dvi dvi 
 55application/x-earthtime etc 
 56application/x-envoy evy 
 57application/x-excel xls,xlc,xll,xlm,xlw 
 58application/x-expandedbook ebk 
 59application/x-gca-compressed gca 
 60application/x-gtar gtar 
 61application/x-gps gps 
 62application/x-gzip gz,x-gzip 
 63application/x-hdf hdf 
 64application/xhtml+xml xhtml,xhtm,xht 
 65application/x-ipix ipx 
 66application/x-jam jam 
 67application/x-javascript js 
 68application/x-java-jnlp-file jnlp 
 69application/x-kjx kjx 
 70application/x-Koan skp,skd,skt,skm 
 71application/x-latex latex 
 72application/x-lzh lzh, LZH 
 73application/x-maker fm 
 74application/x-mapserver mps 
 75application/x-mascot mct 
 76application/x-mif mif,mi 
 77application/x-mocha mocha,moc 
 78application/x-mpeg amc 
 79application/x-mrm mrm 
 80application/x-mscardfile crd 
 81application/x-msaccess mdb 
 82application/x-msclip clp 
 83application/x-msmediaview m13,m14 
 84application/x-msmetafile wmf 
 85application/x-msmoney mny 
 86application/x-mspublisher pub 
 87application/x-msschedule scd 
 88application/x-msterminal trm 
 89application/x-mswrite wri 
 90application/x-NET-Install ins 
 91application/x-netcdf nc,cdf 
 92application/x-netfpx npx 
 93application/x-neva1 nva 
 94application/x-nif nif 
 95application/x-ns-proxy-autoconfig proxy 
 96application/x-pan pan 
 97application/x-perl pm 
 98application/x-pmd pmd 
 99application/x-prc prc 
100application/x-richlink rlf 
101application/x-rogerwilco rwc 
102application/x-salsa slc 
103application/x-scream nmz 
104application/x-sh sh 
105application/x-shar shar 
106application/x-shockwave-flash swf,swfl 
107application/x-smaf mmf 
108application/x-sprite spr,sprite 
109application/x-spt spt 
110application/x-supercard sca 
111application/x-stuffit sit,sea 
112application/x-tar tar,tgz,taz 
113application/x-tcl tcl 
114application/x-tex tex 
115application/x-texinfo texinfo,texi 
116application/x-timbuktu tbp 
117application/x-tkined tki,tkined 
118application/x-troff t,tr,roff 
119application/x-troff-man man 
120application/x-troff-me me 
121application/x-troff-ms ms 
122application/x-wais-source src 
123application/x-wxl wxl 
124application/x-xdma xdm,xdma 
125application/x-xpinstall xpi 
126application/x-yumekara mof 
127application/x-yz1 yz1 
128application/x-zaurus-zac zac 
129application/zip zip,nar 
130audio/basic au,snd 
131audio/echospeech es,esl 
132audio/midi mid,midi 
133audio/tsplayer tsi 
134audio/vnd.qcelp qcp 
135audio/voxware vox 
136audio/x-aiff aif,aiff,aifc 
137audio/X-Alpha5 als 
138audio/x-epac pae 
139audio/x-imy imy 
140audio/x-mio mio 
141audio/x-mod mod, s3z, xm, it, s3m, xmz, itz, mdz 
142audio/x-mpeg mp2, mp3 
143audio/x-mpegurl m3u 
144audio/x-ms-wax wax 
145audio/x-ms-wma wma 
146audio/x-pn-realaudio ra, ram, rm 
147audio/x-pac pac 
148audio/x-pn-RealAudio-plugin rpm 
149audio/x-smd smd,smz 
150audio/x-twinvq vqf, vql 
151audio/x-twinvq-plugin vqe 
152audio/x-wav wav 
153chemical/x-pdb pdb 
154chemical/x-csml csm,csml 
155chemical/x-gaussian-input gau 
156chemical/x-embl-dl-nucleotide emb,embl 
157chemical/x-mdl-molfile mol 
158chemical/x-xyz xyz 
159chemical/x-mopac-input mop 
160drawing/x-dwf dwf 
161image/bmp bmp 
162image/cis-cod cod 
163image/fif fif 
164image/gif gif,ifm 
165image/ief ief 
166image/ifs ifs 
167image/jpeg jpeg,jpg,jpe,jpz 
168image/j2k j2k 
169image/png png,pnz 
170image/svg-xml svg 
171image/svh svh 
172image/tiff tiff,tif 
173image/vnd dwg,svf 
174image/vnd.rn-realflash rf 
175image/vnd.rn-realpix rp 
176image/vnd.wap.wbmp wbmp 
177image/wavelet wi 
178image/x-cals mil,cal 
179image/x-cmu-raster ras 
180image/x-dcx dcx 
181image/x-dxf dxf 
182image/x-eri eri 
183image/x-freehand fh4,fh5,fhc 
184image/x-fpx fpx,FPX 
185image/x-icon ico 
186image/x-pcx pcx 
187image/x-pda pda 
188image/x-pict pict 
189image/x-portable-anymap pnm 
190image/x-portable-bitmap pbm 
191image/x-portable-graymap pgm 
192image/x-portable-pixmap ppm 
193image/x-quicktime qtif, qti丂丂丂  
194image/x-rgb rgb 
195image/x-up-wpng wpng 
196image/x-xbitmap xbm 
197image/x-xpixmap xpm 
198image/x-xwindowdump xwd 
199i-world/i-vrml ivr 
200magnus-internal/imagemap map 
201magnus-internal/parsed-html shtml 
202magnus-internal/cgi cgi 
203text/css css 
204text/html htm,html 
205text/plain txt,asc 
206text/richtext rtx 
207text/tab-separated-values tsv 
208text/vnd.rn-realtext rt 
209text/vnd.rn-realtext3d r3t 
210text/vnd.sun.j2me.app-descriptor jad 
211text/vnd.wap.wml wml 
212text/vnd.wap.wmlscript wmls 
213text/xml xml,xsl 
214text/xul xul 
215text/x-hdml hdml,hdm 
216text/x-mrml mrl 
217text/x-setext etx 
218text/x-speech talk,spc 
219text/x-vcard vcf 
220video/3gpp 3gp 
221video/isivideo fvi 
222video/mpeg mpeg,mpg,mpe 
223video/msvideo avi 
224video/quicktime qt,mov 
225video/vdo vdo 
226video/vivo viv,vivo 
227video/vnd.rn-realvideo rv 
228video/wavelet wv 
229video/x-mng mng 
230video/x-ms-asf asf,asx,lsf,lsx,wm 
231video/x-ms-wmv wmv 
232video/x-ms-wmx wmx 
233video/x-ms-wvx wvx 
234video/mp4 mp4,mpg4 
235video/x-pv-pvx pvx 
236video/x-sgi-movie movie 
237workbook/formulaone vts 
238x-conference/x-cooltalk ice 
239x-gzip gz 
240x-compress z 
241x-lml/x-lml lml 
242x-lml/x-lmlpack lmlpack 
243x-lml/x-evm evm, dcm 
244x-lml/x-ndb ndb 
245x-lml/x-lak lak 
246x-lml/x-gdb gdb 
247x-lml/x-gps trk, wpt, rte 
248x-rar-compressed rar 
249x-uuencode uu, uue 
250x-world/x-svr svr 
251x-world/x-vrml wrl, wrz, WRL, WRZ 
252x-world/x-vrt vrt 
253x-world/x-vream vrw,vre 
254
255MIME增补
256<!--MIME Type--> 
257<mime-mapping extension='.hdml' mime-type='text/x-hdml;charset=KS_C_5601-1987' /> 
258<mime-mapping extension='.wbmp' mime-type='image/vnd.wap.wbmp' />
259<mime-mapping extension='.wml' mime-type='text/vnd.wap.wml' /> 
260<mime-mapping extension='.wmlc' mime-type='application/vnd.wap.wmlc'/> 
261<mime-mapping extension='.wmlsc' mime-type='application/vnd.wap.wmlscriptc' /> 
262<mime-mapping extension='.wmls' mime-type='text/vnd.wap.wmlscript' /> 
263<mime-mapping extension='.wmlscript' mime-type='text/vnd.wap.wmlscript' /> 
264<mime-mapping extension='.ws' mime-type='text/vnd.wap.wmlscript' /> 
265<mime-mapping extension='.wsc' mime-type='application/vnd.wap.wmlscriptc' /> 
266<mime-mapping extension='.mmf' mime-type='application/x-skt-lbs' /> 
267<mime-mapping extension='.si9' mime-type='image/vnd.lgtwap.sis' /> 
268<mime-mapping extension='.si7' mime-type='image/vnd.stiwap.sis' />
269<mime-mapping extension='.nbmp' mime-type='image/nbmp' /> 
270<mime-mapping extension='.sis' mime-type='image/sis' /> 
271<mime-mapping extension='.si6' mime-type='image/si6' /> 
272<mime-mapping extension='.toy' mime-type='image/toy' /> 
273<mime-mapping extension='.nsnd' mime-type='audio/nsnd' /> 
274<mime-mapping extension='.ma1' mime-type='audio/ma1' /> 
275<mime-mapping extension='.ma2' mime-type='audio/ma2' /> 
276<mime-mapping extension='.pmd' mime-type='audio/pmd' />
277<mime-mapping extension='.vib' mime-type='audio/vib' />
278<mime-mapping extension='.ma3' mime-type='audio/ma3' />
279<mime-mapping extension='.ma5' mime-type='audio/ma5' />
280<mime-mapping extension='.ndwn' mime-type='application/ndwn' />
281
282


地震让大伙知道:居安思危,才是生存之道。
posted on 2007-03-25 18:01 小寻 阅读(3893) 评论(0)  编辑  收藏 所属分类: j2se/j2ee/j2me

只有注册用户登录后才能发表评论。


网站导航: