Http请求中Content-Type讲解
来源:互联网 发布:强直性脊柱炎 知乎 编辑:程序博客网 时间:2024/05/29 15:53
引言: 在Http请求中,我们每天都在使用Content-type来指定不同格式的请求信息,但是却很少有人去全面了解content-type中允许的值有多少,这里将讲解Content-Type的可用值,以及在Spring MVC中如何使用它们来映射请求信息。
1. Content-Type
MediaType,即是Internet Media Type,互联网媒体类型;也叫做MIME类型,在Http协议消息头中,使用Content-Type来表示具体请求中的媒体类型信息。
类型格式:type/subtype(;parameter)? type 主类型,任意的字符串,如text,如果是*号代表所有; subtype 子类型,任意的字符串,如html,如果是*号代表所有; parameter 可选,一些参数,如Accept请求头的q参数, Content-Type的 charset参数。例如: Content-Type: text/html;charset:utf-8;
常见的媒体格式类型如下:
- text/html : HTML格式
- text/plain :纯文本格式
- text/xml : XML格式
- image/gif :gif图片格式
- image/jpeg :jpg图片格式
- image/png:png图片格式
以application开头的媒体格式类型:
- application/xhtml+xml :XHTML格式
- application/xml : XML数据格式
- application/atom+xml :Atom XML聚合格式
- application/json : JSON数据格式
- application/pdf :pdf格式
- application/msword : Word文档格式
- application/octet-stream : 二进制流数据(如常见的文件下载)
- application/x-www-form-urlencoded : <form encType=””>中默认的encType,form表单数据被编码为key/value格式发送到服务器(表单默认的提交数据的格式)
另外一种常见的媒体格式是上传文件之时使用的:
- multipart/form-data : 需要在表单中进行文件上传时,就需要使用该格式
Requests部分
Responses部分
Refresh: 5; url=
http://www.zcmhi.com/archives/94.html
Retry-After如果实体暂时不可取,通知客户端在指定时间之后再次尝试Retry-After: 120Serverweb服务器软件名称Server: Apache/1.3.27 (Unix) (Red-Hat/Linux)Set-Cookie设置Http CookieSet-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1Trailer指出头域在分块传输编码的尾部存在Trailer: Max-ForwardsTransfer-Encoding文件传输编码Transfer-Encoding:chunkedVary告诉下游代理是使用缓存响应还是从原始服务器请求Vary: *Via告知代理客户端响应是通过哪里发送的Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)Warning警告实体可能存在的问题Warning: 199 Miscellaneous warningWWW-Authenticate表明客户端请求实体应该使用的授权方案WWW-Authenticate: Basic阅读全文
0 0
- Http请求中Content-Type讲解
- Http请求中Content-Type讲解
- Http请求中Content-Type讲解
- Http请求中Content-Type讲解
- Http请求中Content-Type讲解
- Http请求中Content-Type
- Http请求中Content-Type详解
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- 【Mybatis学习】框架中使用到的设计模式
- NumberUtils简单介绍和具体实例
- C#中BadImageFormatException异常
- access数据库和SQL数据库bit类型的差别
- Spring + Mybatis环境实现Mysql数据库主从切换
- Http请求中Content-Type讲解
- 支持嵌套滚动的控件NestedScrollView
- 矢量图形引擎库VectorDraw Developer Framework更新至v7.7012.1.1,周年8.5折限时特惠!
- log4j.properties配置详解与实例
- 多线程基础学习七:使用synchronized实现多线程情况下的访问次数统计
- This application failed to start because it could not find or load the Qt platform ...
- 穿透内网,连接动态ip,内网ip打洞-----p2p实现原理
- PAT考试乙级1014(C语言实现) 部分正确
- Fedora14 nfs配置 + tiny210 挂载nfs