*
The moose likes JSP and the fly likes URL download Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "URL download" Watch "URL download" New topic
Author

URL download

M. White
Greenhorn

Joined: Dec 27, 2009
Posts: 18

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
Marshal

Joined: Mar 22, 2005
Posts: 41586
    
  54
The browser may be set to save "*.java" files automatically to the downloads directory; check its settings for what to do with "*.java" files.


Ping & DNS - my free Android networking tools app
M. White
Greenhorn

Joined: Dec 27, 2009
Posts: 18

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
Marshal

Joined: Mar 22, 2005
Posts: 41586
    
  54
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URL download