Specify download size in DownloadStream

Hello,

we use DownloadStream to send generated reports to the users.
This works fine, but one thing we miss is the progress indicator of the browser.

It looks like the DownloadStream has no way to tell the browser the size of the response…

Why is this missing ?
We have some very heavy downloads (100-300MB zip files with images inside), and it’s annoying for the users to not see how far download has progressed and how long it is expected to take until finised.

André

Could you extend the InputStream you pass to DownStream in a such way that it gives notifications while the download progresses?

Haven’t tried it, but I believe it should work as you wish when you set “Content-Length” header:

DownloadStream ds = ...
ds.setParameter("Content-Length", size);

Of course, you have to be able to obtain file size on the server side.

Works like a charm.
But why the FileResource class does it not by itself… ?

André

Just opened a ticket:

http://dev.vaadin.com/ticket/5356

André