users@glassfish.java.net

Re: proxy setting problem

From: <glassfish_at_javadesktop.org>
Date: Wed, 02 Dec 2009 00:11:34 PST

Hi Alberto

There are so many wrong posts in the web that I started to check and test it for myself. There are only system props for http.proxyHost/...Port and https.proxyHost/...Port. There are no things like proxyUser oder UserName or Password. All this stuff is nonsens or deprecated or died along time ago. When you do it that way it is going to work:

  public static void init() {
    System.setProperty("http.proxyHost", PROXY_HOST);
    System.setProperty("http.proxyPort", PROXY_PORT);
    System.setProperty("https.proxyHost", PROXY_HOST);
    System.setProperty("https.proxyPort", PROXY_PORT);

    Authenticator.setDefault(new Authenticator() {
      @Override
      protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(PROXY_USER, PROXY_PW.toCharArray());
      }
    });
  }

Regards,
Stephan
[Message sent by forum member 'stephansst' ]

http://forums.java.net/jive/thread.jspa?messageID=374251