aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes I need your Help!!! -- How to Access protected Web page/Image file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "I need your Help!!! -- How to Access protected Web page/Image file?" Watch "I need your Help!!! -- How to Access protected Web page/Image file?" New topic
Author

I need your Help!!! -- How to Access protected Web page/Image file?

Sharp Tan
Greenhorn

Joined: Aug 16, 2001
Posts: 6
Hi all,
I try to access same web pages and image files from a potal. Someone suggested me to use "Authenticator" class. I create a subclass named "myAuthenticator" as following:
class myAuthenticator extends Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("Password needed");
return new PasswordAuthentication("myid", "pw".toCharArray());
}
}
Before I create a URLConnection I call
Authenticator.setDefault(new myAuthenticator);
I try to access "http://mail.yahoo.com" and my own potal. It doesn't work. What I get is still the login page.
Who know the reason? Anybody has solution to solve my problem?
I'm very thankful for your help!
Sharp
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: I need your Help!!! -- How to Access protected Web page/Image file?