Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
[Help] How to Free/Unlock the DownloadStream Resource??
I try to display serval Images in an Popout Windows, those image files are loaded from external folder through
"FileResource" class, which works fine.
Because Image file name cannot be change. so new file need to overwrite the existing one. so if user open the image page and re-upload the image to overwrite the existing file will raise IOexception.
So far, I try to override the FileResource class to close InputStream, replace the source. still getting the same error: File cannot be modified.
Anyone have idea, how to safely replace the file open by FileResource class?
Any suggestion will be appricated. Thanks!
Hi,
Instead of using a FileResource, how about StreamResource? That's more suited for dynamic content. You can still read the file on load and save a new file on uploads, but then you won't be so married to the actual copy on the physical drive.
-Olli
Thanks lot Olli Tietäväinen ~
Accroding to your suggestion, I made a new copy, already workaround this issue.