File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Authenticator Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Authenticator Class" Watch "Authenticator Class" New topic

Authenticator Class

Abhijt Rao

Joined: Oct 30, 2008
Posts: 2
hi i have this piece of code for conecting to authenticated proxy in my class
static class MyAuthenticator extends Authenticator {

MyAuthenticator() {

protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("PasswordAuthentication ");
return new PasswordAuthentication(
System.getProperty("sonic.http.proxyUsername"), System.getProperty("sonic.http.proxyPassword").toCharArray());


and I also do

MyAuthenticator myAuth = new MyAuthenticator();


This code works absolutely fine in j2sdk1.4 and the getpasswordAuthentication method is called but in jdk1.5 (i am using jdk1.5.0_13) this method doesnt get called at all

Do i need to do something differently for 1.5?
Joe Ess

Joined: Oct 29, 2001
Posts: 9167

Welcome to the JavaRanch.
You must have missed our naming policy on the way in. In short, your displayed name must be your real (or at least real-sounding) first and last name separated by a space. You can change your displayed name here.

[How To Ask Questions On JavaRanch]
Abhijt Rao

Joined: Oct 30, 2008
Posts: 2

These are my connection parameters

sonic.http.proxyPassword=<set to my certs directory>
I agree. Here's the link:
subject: Authenticator Class
jQuery in Action, 3rd edition