• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
reply
    Bookmark Topic Watch Topic
  • New Topic