MIME (Multipurpose Internet Mail Extensions) 是描述消息内容类型的因特网标准,做web不可避免要用到几个,例如下载文件
response.setContentType("application/x-gzip");
response.addHeader("Content-Disposition", "attachment; filename="+fname);
下面按照常见主类型列出常用mime类型
text
mime类型 | 扩展名 | 说明 |
text/html | html htm stm | |
text/plain | txt c h bas | |
text/css | css | |
text/xml | xml数据 | |
image
mime类型 | 扩展名 | 说明 |
image/gif | gif | |
image/jpeg | jpeg jpg jpe | |
image/png | png | |
application
mime类型 | 扩展名 | 说明 |
application/x-javascript | js | |
application/json | json数据 | |
application/msword | doc | |
application/vnd.ms-excel | xls | |
application/vnd.ms-powerpoint | ppt | |
application/pdf | ||
appication/rtf | rtf | |
application/x-gzip | gz | |
application/x-tar | tar | |
application/zip | zip | |
application/octet-stream | 任意的二进制数据传输 |