aspose file tools*
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
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: 39551
    
  27
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 - updated with new look and Ping home screen widget
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: 39551
    
  27
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: URL download
 
Similar Threads
FileInputStream Exception - Bad file descriptor
Redirect after close download box
Problem with returning images from a servlet
Mac OS X > Copying JavaApplicationStub using Java code
File Read & Writing