Http报头Accept与Content-Type的区别(转)

1.Accept属于请求头, Content-Type属于实体头。

Http报头分为通用报头,请求报头,响应报头和实体报头。

请求方的http报头结构:通用报头|请求报头|实体报头

响应方的http报头结构:通用报头|响应报头|实体报头

2.Accept代表发送端(客户端)希望接受的数据类型。 

比如:Accept:text/xml;

代表客户端希望接受的数据类型是xml类型

Content-Type代表发送端(客户端|服务器)发送的实体数据的数据类型。

比如:Content-Type:text/html;

代表发送端发送的数据格式是html。

3、二者合起来

Accept:text/xml;

Content-Type:text/html

即代表希望接受的数据类型是xml格式,本次请求发送的数据的数据格式是html。

参考:

http://blog.csdn.net/muzizongheng/article/details/46795243(以上内容转自此篇文章)

原文地址:https://www.cnblogs.com/EasonJim/p/8316020.html

时间: 2024-08-04 09:53:12

Http报头Accept与Content-Type的区别(转)的相关文章

转载 SharePoint【Site Definition 系列】– 创建Content Type

转载原地址:  http://www.cnblogs.com/wsdj-ITtech/archive/2012/09/01/2470274.html Sharepoint本身就是一个丰富的大容器,里面存储的所有信息我们可以称其为“内容(Content)”,为了便于管理这些Conent,按照人类的正常逻辑就必然想到的是对此进行“分类”.分类所涉及到的层面又必然包括: 1.分类的标准或特征描述{即:类型属性(或:与该类型项目相关联的属性)}. 2.对应类的关联动作(即:工作流,行为以及其他设置)  

Jsoup问题---获取http协议请求失败 org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml.

Jsoup问题---获取http协议请求失败 1.问题:用Jsoup在获取一些网站的数据时,起初获取很顺利,但是在访问某浪的数据是Jsoup报错,应该是请求头里面的请求类型(ContextType)不符合要求. 错误信息: Exception in thread "main" org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be text/*, application/xml, or applic

org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported

踩到了一个神坑,明明@RequestMapping注解并没有设置consumes,即没有限定请求参数的类型.却出现文章底部的错误,原因竟然是同一个model下注解了两个@JsonBackReference. @Entity // 用户 public class User extends IDomain { @Column(columnDefinition = "varchar(255) comment '[电话]'") private String phone; @Column(col

Spring MVC 前后台传递json格式数据 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

报错如下: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported 解决方案: 引入如下包: 问题既解决. Spring MVC 前后台传递json格式数据 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

how to set default content type in document set in Sharepoint

I had encounter a issue when set default content type in document set, had to work around it Create a custom document set in library, besides I want the document set only contains a content type I want to use, hence add a custom content type in the d

InfoPath与SharePoint之(六)在表单库里引用InfoPath Form Content Type

在表单库里引用InfoPath Form Content Type 在上一篇,介绍了如何把InfoPath Form类型的Content Type发布到SiteCollection,发布完之后,就可以在已经存在的表单库里引用了. 打开一个已经存在的表单库,点击Ribbon上的Library Settings: 在Settings页面,点击Advanced Settings: 默认情况下,添加Content Type功能是关闭的,在这里开启: 再回到Library Settings页面,就可以添加

InfoPath与SharePoint之(五)发布InfoPath表单到Content Type

不管是在List里定制化表单,还是发布表单到Library,都有一个缺陷,就是不能被其他的List/Library重复使用. 因此SharePoint提供了一个功能,可以把表单发布成Content Type,这样其他的List/Library就可以引用它了. 打开之前设计的一个表单: 选择发布到SharePoint Server: 输入一个Site 的URL: 在类型这里,选择Content Type: 选择创建一个新的Content Type.如果以前发布过这个Content Type,现在要

the request doesn't contain a multipart/form-data or multipart/form-data stream, content type header

the request doesn't contain a multipart/form-data or multipart/form-data stream, content type header 一,HTTP上传的基本知识 在Form元素的语法中,EncType表明提交数据的格式 用 Enctype 属性指定将数据回发到服务器时浏览器使用的编码类型.下边是说明: application/x-www-form-urlencoded: 窗体数据被编码为名称/值对.这是标准的编码格式. mult

org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported或其他Content type不支持处理

很久没从头到尾搭框架,今天搭的过程中,springmvc controller方法入参用@RequestBody自动绑定参数时一直提示各种 not supported 排查问题有两个解决路径: 1)使用post协议提交时,请检查Content type类型,如: $.ajax({ type: "POST", contentType: "application/json;charset=UTF-8", url: "/reg", data: JSON

CSOM创建Content Type并指定GUID

SharePoint 2013 Client Object Mode在创建Content Type时有一个限制,不能给Content Type指定一个GUID,只能由系统随机生成.而在用farm solution部署时,则可以在xml中指定好Content Type的GUID,或者用服务器端对象模型来指定GUID. SharePoint 2013 SP1发布之后,这个问题就迎刃而解了.在新的CSOM对象模型中,可以在创建Content Type时指定GUID.在o365上申请一个免费的开发网站,