java.io.IOException: Server returned HTTP response code: 415 for URL:xxxxxx

java.io.IOException: Server returned HTTP response code: 415 for URL: http://192.168.1.59:8080/mobileapi/scene/save.do?token=9DB2FD6FDD2F116CD47CE6C48B3047EE

at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)


环境描述

Spring MVC 使用 @RequestBody 接收JSON参数转为实体对象

public void save(@RequestBody Scene scene, HttpServletRequest
		request, HttpServletResponse response) throws Exception {

}

客户端添加下面的代码解决问题:

connection.setRequestProperty("Content-Type", "application/json; charset=utf-8");


你可能感兴趣的:(spring,spring,mvc,json,mybatis,RequestBody)