What you’ve done above is to simply remove caching from the initial bootstrap page. Every subsequent request is handled in other methods within AbstractApplicationServlet - which are tricky to override, as some of them are private.
If you’re dealing with Vaadin streaming, add the parameters to the DownloadStream - otherwise, a servlet filter is probably your best bet. Details on SO.
Thanks for your answer here, as well as the more detailed one on stackoverflow.
More in Detail, I’m using a Streamresource (This code basically comes from another user vaadin example who has shown how to integrate a pdf into a vaadin window):
final Embedded pdfContents = new Embedded();
pdfContents.setWidth("500px");
pdfContents.setHeight("500px");
pdfContents.setType(Embedded.TYPE_BROWSER);
StreamResource resource = new StreamResource(new PDF(doc), randomString.generateRandomString(), WebsiteFrame.getDefault().getMainWindow().getApplication());
resource.setCacheTime(1000);
// Set the right mime type
resource.setMIMEType("application/pdf");
pdfContents.setSource(resource);
Before I had the cache time set on “0”, I’ve changed it now to “1000” as marked in your post.
I also tried the setParameter()-Method you’re mentioning on SO, but it doesn’t exist for a StreamResource.
Still, I think I might have solved the issue through generating a random String as title for the pdf. I read somewhere in the vaadin forums that these forces the browser to always reload the pdf and not using the cached version. As far as I have tested this, I’m not experiencing any wrong pdfs displayed through the cache (While about:cache always showed me that the cache grew while a pdf is being displayed, which indicates a new pdf has been added under a new title)
So, basically, this could mean that the new random name did the trick, or what do you think?