ContentType

1常见的媒体格式类型如下:

    text/html HTML格式

    text/plain :纯文本格式      

    text/xml   XML格式

    image/gif gif图片格式    

    image/jpeg jpg图片格式 

    image/pngpng图片格式

   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=“”>中默认的encTypeform表单数据被编码为key/value格式发送到服务器(表单默认的提交数据的格式)

   另外一种常见的媒体格式是上传文件之时使用的:

    multipart/form-data : 需要在表单中进行文件上传时,就需要使用该格式

 

2当你有如下Accept头,将遵守如下规则进行应用:
①Accepttext/html,application/xml,application/json
      将按照如下顺序进行produces的匹配 ①text/html ②application/xml ③application/json
②Acceptapplication/xml;q=0.5,application/json;q=0.9,text/html
      将按照如下顺序进行produces的匹配 ①text/html ②application/json ③application/xml
      参数为媒体类型的质量因子,越大则优先权越高(01)
③Accept*/*,text/*,text/html
      将按照如下顺序进行produces的匹配 ①text/html ②text/* ③*/*

即匹配规则为:最明确的优先匹配。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值