Spring MVC 415 Unsupported Media Type

前端 未结 7 1323
再見小時候
再見小時候 2020-11-28 13:01

I am using Spring 3.2 and try to use an ajax post request to submit an array of json objects. If this is relevant, I escaped all special characters.

I am getting an

7条回答
  •  情歌与酒
    2020-11-28 13:32

    I had consume="application/json" in my request mapping configuration which expects a json input. When I sent a request which is not a JSON input Spring complained about the 415 Unsupported Media Type. So removing the consume="application/json" worked for me. So look into the request input and the accept media type in your Spring controller method signature. A mismatch would throw the 415 error. This will be most likely the reason for the issue.

提交回复
热议问题