Mimic the Export to CSV functionality

What I want to do is similar to a very old question: https://community.mendix.com/link/questions/4304. But there is a difference. For me it is not acceptable to have the intermediate step. So I would have to write and commit a file and then it gets downloaded. The behavior I want is like the Export to CSV which is on a grid. I want to start a microflow that will need to go to Java in which I create the file. And the browser should download it immediately. Is this at all possible? 
1 answers

It can if you would modify your Java to let it return a filedocument. Because you can then trigger the download file action to download this filedocument.