FileDownloader: Switch off browser caching

I’m using the Vaadin FileDownloader.

When clicking on the corresponding button for the first time, Firefox caches the downloaded file. If I’m not refreshing the screen, the second time the browser doesn’t contact FileDownloader anymore but immediately offers the cached file.

The files I’m downloading are dynamically generated before download - so I need an option to switch off this browser behaviour.

I’ve found this link: []
( …

… but how can I do this with FileDownloader?

I have solve this problem by changing filename every time it is downloaded (add timestamp). I know this is not solution for every case…

Hi Matic, yes this is right - I’m doing the same - I do it exactly like in the example under “LAZILY DETERMINE THE CONTENT AND THE NAME OF THE FILE BEING SERVER” on []
But when I’m in my Firefox and click the second time (see description above), the overriden method handleConnectorRequest isn’t any more called and therefore there is no chance to change the filename. Therefore I assume, that it has to do something with caching. But how to force the browser not to cache in this case?

Hi Mirko,
I have the same issue. (Only in Firefox)
When I am downloading the second time, I am getting the previously cached file as well.
When I cleared the cache and tried again, it works fine.

Have you found a solution?


No, unfortunately not. I’ve raised an issue in github now:

Hi Mirko, Thanks for the reply. I have found a solution as posted below by overriding the handleConnectorRequest method of FileDownloader to disable the cache during file download.

Hope this is what you are looking for…

Hi Jamshid, thank you! Yes - and I’ve got a similar response on github. Look here: []
( That solves this problem!