研发埠
标题:
编写Java application时,如何设置proxy的信息,以便访问外部网站?
[打印本页]
作者:
淡写轻描
时间:
2013-7-24 16:53
标题:
编写Java application时,如何设置proxy的信息,以便访问外部网站?
作者:
亮
时间:
2013-7-24 17:05
若在java application中访问外部网站,首先应设置proxy信息,样例代码如下: import java.util.properties; ..... Properties sys = System.getProperties(); sys.put("proxySet","true"); sys.put("proxyHost","myHTTP.proxyserver.com"); sys.put("proxyPort","80"); System.setProperties(sys); u = newURL(website); connect =(HttpURLConnection)u.openConnection(); .....
欢迎光临 研发埠 (http://bbs.yanfabu.com/)
Powered by Discuz! X3.2