sexta-feira, 3 de outubro de 2008

Acessando URL com proxy

System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", "172.1.1.2");
System.getProperties().put("proxyPort", "8080");
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
"Usuario"),"Senha").toCharArray());
}
});

URL u = new URL(url);

Nenhum comentário: