public ResponseEntity updateUser() throws Exception {
URL restURL = new URL("http://bizadmin.kongapi.com/CreditReportTodayData/find?");
HttpURLConnection conn = (HttpURLConnection) restURL.openConnection();
//请求方式
conn.setRequestMethod("POST");
//设置是否从httpUrlConnection读入,默认情况下是true; httpUrlConnection.setDoInput(true);
conn.setDoOutput(true);
//allowUserInteraction 如果为 true,则在允许用户交互(例如弹出一个验证对话框)的上下文中对此 URL 进行检查。
conn.setAllowUserInteraction(false);
PrintStream ps = new PrintStream(conn.getOutputStream());
String query = "time=2018-02-21";
ps.print(query);
ps.close();
InputStream inputStream = conn.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = null;
StringBuffer buffer = new StringBuffer();
while ((str = bufferedReader.readLine()) != null) {
buffer.append(str);
}
bufferedReader.close();
inputStreamReader.close();
// 释放资源
inputStream.close();
conn.disconnect();
JSONObject jsStr = JSONObject.fromObject(buffer.toString());
return new ResponseEntity(jsStr);
}
URL restURL = new URL("http://bizadmin.kongapi.com/CreditReportTodayData/find?");
HttpURLConnection conn = (HttpURLConnection) restURL.openConnection();
//请求方式
conn.setRequestMethod("POST");
//设置是否从httpUrlConnection读入,默认情况下是true; httpUrlConnection.setDoInput(true);
conn.setDoOutput(true);
//allowUserInteraction 如果为 true,则在允许用户交互(例如弹出一个验证对话框)的上下文中对此 URL 进行检查。
conn.setAllowUserInteraction(false);
PrintStream ps = new PrintStream(conn.getOutputStream());
String query = "time=2018-02-21";
ps.print(query);
ps.close();
InputStream inputStream = conn.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = null;
StringBuffer buffer = new StringBuffer();
while ((str = bufferedReader.readLine()) != null) {
buffer.append(str);
}
bufferedReader.close();
inputStreamReader.close();
// 释放资源
inputStream.close();
conn.disconnect();
JSONObject jsStr = JSONObject.fromObject(buffer.toString());
return new ResponseEntity(jsStr);
}