Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP authentication - can't figure it out!

 
joey jojo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to download a file from a website, however, you need to login prior to accessing the file. If I try and access the file using the direct url path, it just redirects me to the login page. The server uses basic authentication.

Here's an example I found on the internet. However, I can't get it to work; it still redirects me to the login page. Am I missing something?

 
Tim Moores
Bartender
Posts: 2674
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the getPasswordAuthentication method ever being called?

For any HTTP operation more complex than a simple URL access (like if authentication is involved) I'd use the Apache HttpClient library.
 
Rob Spoor
Sheriff
Pie
Posts: 20492
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic