Hi,

For authentication http.proxyUser and http.proxyPassword don't seem to
work, another way to do it is using java.net.Authenticator.

System.getProperties().put("proxySet","true");
System.getProperties().put("proxyPort","3128");
System.getProperties().put("proxyHost","localhost");
Authenticator.setDefault(new
SimpleAuthenticator("username","password"));

I created a class Simple Autheticator:

import java.net.Authenticator;
import java.net.PasswordAuthentication;

public class SimpleAuthenticator extends Authenticator
{
   private String username, password;
   public SimpleAuthenticator(String username, String password)
   {
      this.username = username;
      this.password = password;
   }
   protected PasswordAuthentication getPasswordAuthentication()
   {
      return new PasswordAuthentication(
             username,password.toCharArray());
   }
}

Julian.

On Apr 7, 2:33 pm, "Julian (Google)" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> You could change the Setting System Properties:
>
> Add the following lines in your Java code so that JVM uses the proxy
> to make HTTP calls. This would, of course, require you to recompile
> your Java source.
>
> System.getProperties().put("http.proxyHost", "someProxyURL");
> System.getProperties().put("http.proxyPort", "someProxyPort");
> System.getProperties().put("http.proxyUser", "someUserName");
> System.getProperties().put("http.proxyPassword", "somePassword")
>
> Another method is using Command Line JVM Settings:
>
> The proxy settings are given to the JVM via command line arguments:
>
> $ java -Dhttp.proxyHost=proxyhostURL
> -Dhttp.proxyPort=proxyPortNumber
> -Dhttp.proxyUser=someUserName
> -Dhttp.proxyPassword=somePassword javaClassToRun
>
> Julian.
>
> On Apr 5, 1:45 pm, Himadri <[EMAIL PROTECTED]> wrote:
>
> > I am using gdata api behind a proxy server. How can I set my proxy
> > username password in my program. I have set the properties
> > http.proxyHost and http.proxyPort.
>
> > Regards.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to