I am writing a simple plugin that generates a special purpose Powerpoint presentation from an existing Confluence page.
The file needs to be (1) generated upon the user clicking a button, (2) stored somewhere temporarily and (3) be offered to the (authenticated) user to download by an “open/dowload file” prompt.
The user interface part (1) is working as expected, but I am stuck in (2)nd and (3)rd part. Currently I am storing the file in the local plugin directory by most basic means:
File file = new File("export.pptx"); // ... Open stream, write to file and close stream
But I am aware that this is far from being the best practice. Where should I store these generated files instead? How can I authenticate the user who clicked the button to access this file, get a Uniform Resource Identifier belonging to the file so that I can redirect the user to this address and pop up the “open/download file” prompt?
By examining other plugins, I’ve concluded that I am probably going to need to use the GateKeeper interface, but there are unfortunately no tutorials about using it. Therefore, a most basic functional code example would be highly appreciated.