in elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/util/HttpClientUtils.java [120:144]
public static HttpResult httpPost(final String url, final List<String> paramValues, final String encoding, final long readTimeoutMilliseconds) {
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestMethod("POST");
connection.setConnectTimeout((int) readTimeoutMilliseconds);
connection.setReadTimeout((int) readTimeoutMilliseconds);
connection.setDoOutput(true);
connection.setDoInput(true);
connection.getOutputStream().write(encodingParams(paramValues, encoding).getBytes(StandardCharsets.UTF_8));
String response;
if (HttpURLConnection.HTTP_OK == connection.getResponseCode()) {
response = IOUtils.toString(connection.getInputStream(), encoding);
} else {
response = IOUtils.toString(connection.getErrorStream(), encoding);
}
return new HttpResult(connection.getResponseCode(), response);
} catch (final IOException ex) {
throw new HttpClientException(ex);
} finally {
if (null != connection) {
connection.disconnect();
}
}
}