0
를 사용하여 HttpClient를에 TLSv1.2을 설정는이 코드에서 TLSv1.2 연결을 설정해야합니다 PostMethod
public String login(){
HttpClient client = new HttpClient();
log.trace("#LOGIN");
log.trace("url : " +this.url_login);
log.trace("grant_type : " +this.grant_type);
log.trace("customer_secret : " +this.customer_secret);
log.trace("username : " +this.username);
log.trace("customer_key : " +this.customer_key);
PostMethod post = new PostMethod(this.url_login);
post.setRequestHeader("content-Type", "application/x-www-form-urlencoded");
NameValuePair[] data = {
new NameValuePair("grant_type", this.grant_type),
new NameValuePair("client_id", this.customer_key),
new NameValuePair("client_secret", this.customer_secret),
new NameValuePair("username", this.username),
new NameValuePair("password", this.password+this.security_token)
};
post.setRequestBody(data);
try {
client.executeMethod(post);
String response = post.getResponseBodyAsString();
JSONObject json = new JSONObject(response);
.........
내가 어떻게 할 수 있습니까? SSLContext를 사용하여 가능하다는 것을 알았지 만 코드를 다시 작성하고 싶지는 않습니다. (광산 프로젝트가 아닙니다) 감사합니다.
다른 해결책이 있습니까? – stefanOM
아쉽게도 Java 8로 전환 할 수 없으면 사용자 지정 SSLContext를 사용하여 TLS 1.1 및 1.2를 설정해야합니다. 프로덕션 환경에서 OS 레벨이 Java 8을 지원할 수 없었기 때문에 비슷한 것을해야했습니다. Java 7이 필요합니다. TLS 1.1 및 1.2를 지원하는 JVM의 첫 번째 버전이기 때문입니다. 필자는 그들이 Java 6에 대한 지원을 다시 포팅했다고 믿지 않습니다. – Mike