We have wc.setProxyServer( "server", port );
But how do we supply the uid/pwd credentials to the webproxy ?
WebConversation context = new WebConversation();
String pwd = "proxy_username") + ":" + "proxy_password"; BASE64Encoder B64Encoder = new BASE64Encoder(); String encodedPassword = B64Encoder.encode(pwd.getBytes());
Properties systemProperties = System.getProperties(); systemProperties.setProperty("proxySet", "true"); systemProperties.setProperty("proxyHost", "your_proxy_name"); systemProperties.setProperty("proxyPort", "your_proxy_port"); System.setProperties(systemProperties);
try{ context.setHeaderField("Proxy-Authorization", "Basic"+encodedPassword); } catch(Exception e){ e.printStackTrace(); }
Log in to post a comment.
We have wc.setProxyServer( "server", port );
But how do we supply the uid/pwd credentials to the webproxy ?
WebConversation context = new WebConversation();
String pwd = "proxy_username") + ":" + "proxy_password";
BASE64Encoder B64Encoder = new BASE64Encoder();
String encodedPassword = B64Encoder.encode(pwd.getBytes());
Properties systemProperties = System.getProperties();
systemProperties.setProperty("proxySet", "true");
systemProperties.setProperty("proxyHost", "your_proxy_name");
systemProperties.setProperty("proxyPort", "your_proxy_port");
System.setProperties(systemProperties);
try{
context.setHeaderField("Proxy-Authorization", "Basic"+encodedPassword);
}
catch(Exception e){
e.printStackTrace();
}