aspose file tools*
The moose likes Distributed Java 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 » Distributed Java
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
Fredrik Safstrom
Greenhorn

Joined: May 15, 2001
Posts: 20
Sharp,
In this case I don't think your Authenticator works...
Yahoo mail seems to use JSP, ASP or something similar to ensure security, so the Authenticator doesnt work.
If you could have typed in "http://UserName:Password@mail.yahoo.com" in your browser and go straight into your mail box, then you can get the Authenticator to work...
Maybe if Yahoo Mail uses parameters like "http://mail.yahoo.com?User=UserName&Password=PassWord" you can figure out a way of heading straight into your mail-box...
I think you will have to ask Yahoo about that...
/Bamse
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: I need your Help!!! -- How to Access protected Web page/Image file?