415 Unsupported Media Type with Spring 3.2

后端 未结 5 2115
遇见更好的自我
遇见更好的自我 2020-12-06 08:16

I\'m trying to insert and/or update data into the database using the PUT method via JSON using jQuery 1.6, (Jackson 2.1.1 and Spring 3.

5条回答
  •  没有蜡笔的小新
    2020-12-06 08:38

    The content type that the browser sends, Content-Type: application/json, does not seem to match @RequestBody final MultiValueMap data.

    Either:

    • Send application/x-www-form-urlencoded (in which case you could easier use HttpPutFormContentFilter instead).

    • Or: change this into something like @RequestBody final MyDTO data as explained in JQuery, Spring MVC @RequestBody and JSON - making it work together.

提交回复
热议问题