This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Urgent help Required!!

 
Sanjeev Shahi
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! ALL,
I've created a program to download files from internet. In this program I've used.........
java.net.Authenticator and java.net.PasswordAuthentication
package to authenticate the website. This was working fine when the site had small pop up window for Login but this logic is not working for the site which requires User to enter User Id and pass on the site itself and not in Pop up window. So tell me what to do in this situation.

SS
 
Sunny Liu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.net.Authenticator and java.net.PasswordAuthentication do not deal with HTML-FORM base anthentication, and there is no standard way how do peoples define their HTML username and password fields. If you are making a generic utility to do this job, it would be a pretty hard task. in your java code, you have to parse HTML page which has username and password field on it, to get input field name of these two field and Action URL then using HTTP POST in your URLConnection code to open connection.
for specific web site, you do not need to parse HTML page. you can find these information advance.
third way, You can develop a simple WEB browser to do this trick.
 
Sanjeev Shahi
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! Sunny,
Thanks for your reply. Yes after going through the details of java.net.Authenticator I came to know that it is not for HTML form.
I am creating application for specific URL. Could you please give me some help how to do it. It's really urgent. I want application to take username and pass automatically.
Thanks a lot ,
SS
 
Sanjeev Shahi
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! Sunny,
Just wanted to tell you I got the solution by using setRequestProperty()

SS
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic