当前位置: 动力学知识库 > 问答 > 编程问答 >

Java SSL provider needed for HttpURLConnection?

问题描述:

I'm trying to rid our old code of these System/Security statements:

System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

If I have code that casts an https URLConnection to an HttpUrlConnection, is that security stuff even used? In other words, would anything change if I removed the System.setProperty(... and Security.addProvider(... lines?

URL url = new URL("https://www.google.com");

HttpURLConnection con = (HttpURLConnection) url.openConnection();

The code is currently running on Java 1.5 (soon to be updated to Java 8), and I think the code was written back when it was running Java 1.3.

分享给朋友:
您可能感兴趣的文章:
随机阅读: