How to download attachments from java code directly
0
Hello Team , I'm using java action in microflow to generate a pdf and using download file activity downloading the file and showing in browser . In that pdf we have some attachments link . When we click on that link , the attachment need to be downloaded . For that use case I used deep link . I created a deep link in deep link module and took that link and using that link in java code directly . And we have deeplink microflow , In that microflow we have SFTP download to download the file . Through this microflow download is happening successfully . Here what is the issue is , Whenever the deeplink is called it is navigated to Index.html screen and it is showing a blank screen and parallelly download is happening .If we want to download any other attachment from the pdf we need to go back from blank screen and need to download it . Client's are requesting to remove the blank screen and it should not navigate to any other link in the same tab . The attachments should be downloaded directly without navigate to any other link or we can navigate to next tab for downloading the attachments . These two options we have . Tried with URL redirector to achieve this functionality but it was not working . Can anyone please help on this issue . Thanks in advance !
asked
Vinodhini R
1 answers
0
You could create a REST service to serve the download. Use your microflow as one of the endpoints. As a REST service doesn't need the Mendix frontend to run, you won't have a blank page at the end. Remember, you will need to set the correct HTTP headers yourself such as the mime type of the file.