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

使用httpClient请求数据报错,解决办法:

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

你可能感兴趣的:(java基础)