一些常用的 HTTP Content-type


在Java Web项目中,经常会遇到需要设置Response ContentType,列出几种常用的Content-type,备忘。

  • text/plain – 文本内容
  • text/html – html内容
  • application/vnd.ms-excel – MS Office Excel
  • application/pdf – PDF
  • application/octet-stream – 二进制文件

使用方法:通常使用response.setContentType(“text/plain; charset=UTF-8“);

参考:Multipart Internet Mail Extensions (MIME)

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s