-2
아파치 HttpClient을 사용하여 POST 요청을 보내고 있습니다. 내 Apache HttpClient 인스턴스가 "https : //"요청을 보내는 데 사용하는 프로토콜을 어떻게 결정할 수 있습니까? 다음 코드 블록을 사용하여 POST 요청을 보냅니다.Apache HttpClient - 기본 프로토콜
public void sendPostURL(String url, HashMap<String, String>params, String user, String pass) {
HttpClient client = new HttpClient();
String urlContent = "";
PostMethod method = new PostMethod("https://...");
// Prepare connection information
client.getParams().setParameter("http.useragent", "MyApp");
if ((user != null) &&(pass != null)) {
client.getParams().setAuthenticationPreemptive(true);
client.getState().setCredentials(AuthScope.ANY, (new UsernamePasswordCredentials(user, pass)));
}
// Prepare parameters
for (Map.Entry<String, String> entry : params.entrySet()) {
method.addParameter(entry.getKey(), ((entry.getValue() != null) ? entry.getValue().toString() : ""));
}
try{
// HTTP execution
int returnCode = client.executeMethod(method);
} catch (Exception e) {
// Exception
e.printStackTrace();
} finally {
method.releaseConnection();
}
}
나는 HttpClient를 요청을 보내는 데 사용하는 PROTOCOL을 얻을 수있는 방법에 나를 인도 해주십시오. 또한 PROTOCOL을 어떻게 무시할 수 있습니까? 해결책을 원합니다. 미리 감사드립니다.
저는 HTTPS가 SSL인지 TLS인지 알고 싶습니다. 어떻게 결정할 수 있습니까? 또한 세부 정보가 포함 된 프로토콜 이름을 가져 오는 데 사용할 수있는 코드 스 니펫으로 나를 도울 수 있습니까? –