Your response from the server looks good.
The missing part is that you are not handling this response from the client side in the correct way.
Lets assume that your resource url object looks like below in js. (i.e. you already know the resource url, if you don't know it yet, then you will need a separate call to the server to know the download url)
response.downloadUrl = app/media/fileId/document.pdf
All you need to do is set,
window.location = item.downloadUrl;
This will cause the browser to request a resource from the server, the response from the server must include Content-Disposition:attachment;
. It will cause the browser to show the download dialog.
P.S. I have recently worked on a similar functionality. If you have questions please ask.
When you want to force the browser to show the download prompt for some files (or resources), you must include Content-Disposition:attachment;
in the response header (which you already did).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…