Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported for @RequestBody XXX

问题描述

前端使用ajax发送post请求发送Json数据,spring mvc报Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported for @RequestBody  XXX错误

解决办法

1.重新组装数据
var params=JSON.stringify({param1:param1});

2.ajax请求设置
dataType: "json",
data: param,
contentType: "application/json;charset-UTF-8"

  

Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported for @RequestBody XXX

原文地址:https://www.cnblogs.com/mufire/p/9534268.html

时间: 2024-08-01 22:44:52

Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported for @RequestBody XXX的相关文章

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

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

解决"415 Cannot process the message because the content type 'application/x-www-form-urlencoded' was not the expected type 'text/xml; charset=utf-8'"

wcf basicHttpBinding content-type    text/xml;charset=utf-8 wsHttpBinding  'application/soap+xml; charset=utf-8' webHttpBinding 'application/x-www-form-urlencoded'   对应网页中的post请求 所以如果是post请求wcf服务,要使用webHttpBinding 解决"415 Cannot process the message be

SpringMVC在使用JSON时报错信息为:Content type 'application/json;charset=UTF-8' not supported

直接原因是:我的(maven)项目parent父工程pom.xml缺少必要的三个jar包依赖坐标. 解决方法是:在web子模块的pom.xml里面添加springMVC使用JSON实现AJAX请求. <!--spring mvc-json依赖--> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifact

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

postman测试接口报Content type &#39;text/plain;charset=UTF-8&#39; not supported解决方法

增加一个请求头管理器,添加content-type:application/json.并将请求修改为json数据传输试试. 参考:https://zhidao.baidu.com/question/1644957725975214740.html postman测试接口报Content type 'text/plain;charset=UTF-8' not supported解决方法 原文地址:https://www.cnblogs.com/xiaoni-fighting/p/12298436.

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页面,就可以添加

Jsoup获取部分页面数据失败 org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be text/*, application/xml, or application/

用Jsoup在获取一些网站的数据时,起初获取很顺利,但是在访问某浪的数据是Jsoup报错,应该是请求头里面的请求类型(ContextType)不符合要求. 请求代码如下: private static void testOuGuanMatch() throws IOException{        Document doc = Jsoup.connect("我的URL").userAgent("Mozilla/5.0 (Windows; U; Windows NT 5.1;