spring webflux默认的mimetype对应的参数decoder

论坛 期权论坛 脚本     
已经匿名di用户   2022-3-21 23:58   2673   0
ByteArrayDecoder->("*/*")
ByteBufferDecoder->("*/*")
DataBufferDecoder->("*/*")
ResourceDecoder->("*/*")
StringDecoder->("text/plain;charset=UTF-8")
Jackson2JsonDecoder->("application/json;charset=UTF-8", "application/*+json;charset=UTF-8")
Jaxb2XmlDecoder->("application/xml", "text/xml")
StringDecoder->("text/plain;charset=UTF-8", "*/*")

源代码推测,匹配多个mimetype时,顺序从上到下选取第一个匹配的decoder进行解码(还未验证)

36c8dbf07a69459d036de22931f2336e6b9.jpg

注意:如果传了相应的mimetype,具体能否匹配对应的decoder,还需要看各个decoder的canDecode方法

如:StringDecoder,源码可知,需mimetype正确的前提下,参数类型还需为String类。其他类可以看各自的canDecode方法

eb4a49d85d368347976eed0f24cfcb823b1.jpg

转载于:https://my.oschina.net/u/2316420/blog/2989813

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:81
帖子:4969
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP