406 Not Acceptable: Spring 3.2 + JSON + AJAX

前端 未结 2 774
予麋鹿
予麋鹿 2021-01-20 22:08

Searched tons of sites and even stackoverflow but have not found a solution to this problem. Looks like lot of people have encountered this problem but its seems a unified s

相关标签:
2条回答
  • 2021-01-20 22:14

    I also faced up with a same problem. After debugging Spring I found that ServletPathExtensionContentNegotiationStrategy tries to determine media type based on an extension in the URL. (Probably, because it cannot deduce what media type it should return from Accept header which contained */* in my case.)

    So, one of the way to fix this is to rename URL in mapping by replacing .html by .json.

    0 讨论(0)
  • 2021-01-20 22:18

    God, it almost kills me. I tried whatever I can, still stuck there. But finally I figured it out. The reason is Spring, download Spring 3.1.1 and replace all the jars with 3.1.1jars, and it works. All your config is good.

    0 讨论(0)
提交回复
热议问题