Link to a file that can be shared

I’m using Vaadin to make a file sharing frontend. ie. upload a file and its available with a permenant link and qr code for downloading.

In the backend the files are stored on a network share, which Java has access to.

However I can’t make the link shareable:

new Link(name, new FileResource(file));

This provides a link that downloads the file, but only the user that sees that link can download it. Copying the link and sharing it with someone else gets a 410 Session expired error.

Is there a way I can make a link to a file like this and have it shareable for other people to download it?

One thing you could do would be to generate your own urls using parameters or URI and handle serving the files yourself.
So your links might look something like:
http://…/yourApp?file=SomeFile.pdf or http://…/yourApp#SomeFile.pdf
This way in your App you can use Listeners to gather the information from the URL and then “manually” serve the file.
Doing it this way any user can use the link. This way you can even make it so that only users who have a login can access the files or you need a permission to access certain files.