Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URL download

 
M. White
Greenhorn
Posts: 18
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys!

I have a method that will download a file from a specified URL, but my browser that does not prompt a download dialog? Am i doing it right?here is my code (im using webwork framework):



Thanks for the help.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The browser may be set to save "*.java" files automatically to the downloads directory; check its settings for what to do with "*.java" files.
 
M. White
Greenhorn
Posts: 18
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im using Mozilla Firefox and i have set Downloads as "always ask me where to save files" option under Option-->Main menu. Also, I have read that: response.setHeader("Content-Disposition","attachment;filename=JavaGetUrl.java") will force the download dialog to show up.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im using Mozilla Firefox and i have set Downloads as "always ask me where to save files" option

In that case it should indeed prompt. Can you see the request going out, and the response returning? The Firefox extension LiveHttpHeaders will give you that information.

Also, I have read that: response.setHeader("Content-Disposition","attachment;filename=JavaGetUrl.java") will force the download dialog to show up.

That is incorrect. If the browser is set not to prompt then there's nothing the web app can do about it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic