如何设置HTTP代理在applet [英] How to set Http Proxy in an applet

查看:206
本文介绍了如何设置HTTP代理在applet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关Java桌面应用程序后,我们设置这些属性。

For a java desktop application after we set these properties

System.setProperty("java.net.useSystemProxies","true");
System.setProperty("http.proxyHost", "1.1.1.1");
System.setProperty("http.proxyPort", "8080");

每一个HTTP连接将通过定义的代理来完成。

every http connection will be done through the defined proxy.

但是对于这些小程序无法正常工作。(在一个applet查看它,但它不浏览器。)
小程序总是使用在控制面板\\ java的\\网络设置中定义这些设置\\代理设置。

But for an applet these does not work.(In an applet viewer it does but in a browser it doesnt.) Applet always uses these settings which are defined in control panel\java\network settings\proxy settings.

如何设置一个applet代理?
(在每一个打开的连接使用代理类不是我一个解决方案。)

How can i set the proxy in an applet? (Using proxy class in every opening connection is not a solution for me.)

Applet的签名并用java编译1.6

Applet is signed and compiled with java 1.6

推荐答案

我想,真正的原因是,系统属性方法行不通是由小应用程序启动时,Java运行时系统已经读属性并设置默认代理选择。

I imagine that the real reason that the System properties approach doesn't work is that by the time the applet starts, the Java runtime system has already read the properties and set up the default proxy selector.

你有的ProxySelector 试图用?请参阅这个文件

Have you tried using ProxySelector? Refer to section 4) of this document.

当然,这只是有可能当你的小应用程序是一个签名的applet工作。

Of course, this is only likely to work when your applet is a signed applet.

这篇关于如何设置HTTP代理在applet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆