I have a task that requires me to make a downloadable link. This link is sent by email to a certain user and it has a unique id in it. For example link https://localhost:8080/user/sent/download/ should trigger the download for the file. How can I achieve this in the backend.
I use primefaces and jsf but only from input from the application itself
<h:commandLink ajax="false" value="Generate">
<p:fileDownload value="#{bean.download()}"></p:fileDownload>
</h:commandLink>
This works without any problems but when clicking the link that I described, the download must trigger immediately. Redirecting the user to a page with a button link is not an option
I know there are some REST API specifications that can solve my problem but I do not know what to search for exactly