Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Big binary file interactive downloading

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let say we have WEB application, which creates the temporary file and user should be able to download this file on his machine (if he wishes to do it).

File can have a huge size (for example, 200MB), contains binary data and have unknown type (no extension at all or unknown extension). So the user should not be allowed to open file in the Browser, but only download it on his hard drive. There are different possible solutions and all of them have some problems:

1) Display link to this file: <a href="file name">Download file</a>
It works, but sometimes the system automatically begins to download a context of the file on the page -- We don't want it
Sometimes the system displays the dialog box " File downloading" with "OPEN", "SAVE", "CANCEL" and "MORE" buttons -- Again we don't want to show "OPEN" option to user

2) Use context-menu: option "Save Target AS"
But context menu contains again "OPEN" option-- we don't want to show this option to user

3) Use force-download feature
In this case the page contains the link to jsp, which actually activates this feature, such as:
<a href="myForceDownload.jsp?filename=file name></a>

This jsp sets the specific context type in the response:
and write the file in the output stream. The system displays the dialog box, which is includes only "SAVE","CANCEL" options -- It is good
But the problems are here:
Downloading can take a lot of time, but there are no any progress messages or, at least, some warning message.
Sometimes nothing happens except "Done" message in the Browser status bar, but no file has been downloaded
The worsens things are that we have no control (or at least visualization) of this process.

Any idea how this kind of task can be solved better?

Thanks in advance for any response on this message
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I would go for a trusted applet embedded in the JSP page.

Whether or not this is a good approach for you depends a bit on your user base (will they get along OK with applets? Will they have an up-to-date plug-in their browser?).

But at least with an applet you can avoid altogther the Open/Save/Cancel dialog normally presented by your browser.


Vlad Gurevich
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

It is a good idea to use applet, but I am not sure about user base to run applets and I am still looking for some solution within standard Browser tools and force-download feature

Thank you very much
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic