首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

HttpURLConnection设立代理服务器

2012-09-09 
HttpURLConnection设置代理服务器1、设置系统数据System.setProperty(http.proxyHost, proxy.com)Syst

HttpURLConnection设置代理服务器
1、设置系统数据

System.setProperty("http.proxyHost", "proxy.com");System.setProperty("http.proxyPort", "80");URL url=new URL("http://someserver/somepage");URLConnection uc = url.openConnection ();String encoded = new String      (Base64.base64Encode(new String("username:password").getBytes()));uc.setRequestProperty("Proxy-Authorization", "Basic " + encoded);uc.connect();

热点排行