public boolean casChangePassword(String uuid, String password) {
try {
URL url = new URL(changPassWordUrl);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
OutputStream outputStream = httpURLConnection.getOutputStream();
String content = "id=" + URLEncoder.encode(uuid, "gbk") + "&password=" + URLEncoder.encode(password, "gbk");
outputStream.write(content.getBytes());
InputStream inputStream = httpURLConnection.getInputStream();
byte[] b = new byte[1024];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
int len = 0;
while (true) {
len = inputStream.read(b);
if (len == -1) {
break;
}
byteArrayOutputStream.write(b, 0, len);
}
String response = byteArrayOutputStream.toString();
if (response.trim().equals("true")) {
return true;
}else{
return false;
}
} catch (Exception e) {
e.printStackTrace();
logger.error("casChangePassword error", e);
return false;
}
}