Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpClient just wont download a audio file

 
olze oli
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have the following code:


but it wont download the file.
i retrieve a 302 Found from the server, but httpclient wont follow
when i test another website where i'm sure that there will be no 302 then it works
can someone please help me? :/
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
302 means that there is a temporary redirect. Check out the getFollowRedirects and setFollowRedirects of HttpMethod. It should be set to true.

For your information, HttpURLConnection and probably most other classes for connecting to web servers have similar methods.
 
olze oli
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its a HttpPost, looks like there's no such method
 
olze oli
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so as i heard its against some RFC or so... but FF, IE and so on can handle it
the overwritten code which works for me is:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic