JavaFXWebEngine:对https网站使用http代理
我正在尝试使用javafxwebengine/webview连接到一个网站。我使用的代理不支持https协议(因此仅支持http)。当我尝试连接到http网站时,它可以工作。但是,当我尝试加载https网站时,它会忽略代理并使用我的internet连接。 当我在浏览器中使用相同的代理时,我也可以连接到https网站,我想知道是否有可能更改我的代码,以便webengine仍然使用我的http代理,而不是切换到正常的internet连接 我的代码:JavaFXWebEngine:对https网站使用http代理,java,http,javafx,proxy,webengine,Java,Http,Javafx,Proxy,Webengine,我正在尝试使用javafxwebengine/webview连接到一个网站。我使用的代理不支持https协议(因此仅支持http)。当我尝试连接到http网站时,它可以工作。但是,当我尝试加载https网站时,它会忽略代理并使用我的internet连接。 当我在浏览器中使用相同的代理时,我也可以连接到https网站,我想知道是否有可能更改我的代码,以便webengine仍然使用我的http代理,而不是切换到正常的internet连接 我的代码: final String[] pArray = l
final String[] pArray = line.split(":");
System.out.println("IP:" + pArray[0] + " Port:" + pArray[1]);
System.setProperty("http.proxyHost",pArray[0]);
System.setProperty("http.proxyPort",pArray[1]);
System.setProperty("http.proxyUser",pArray[2]);
System.setProperty("http.proxyPassword",pArray[3]);
Authenticator.setDefault(
new Authenticator() {
@Override
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(pArray[2], pArray[3].toCharArray());
}
}
);
System.setProperty("java.net.useSystemProxies", "true");
System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
加载Web引擎时:
engine.load("http://whatismyip.host");
该网站(仅限http的网站)显示代理IP
但当我这样做的时候:
engine.load("https://myip.is");
它显示我的家庭连接的IP,这意味着它忽略http代理。。。
我怎样才能改变这一点
关于如果只使用
System.setProperty(“https.proxyHost”,pArray[0]),会发生什么
而不是System.setProperty(“http.proxyHost”,pArray[0])代码>和类似位置?这将返回错误,因为代理不支持https。