I came a little closer by making custom http:headers, but I have to confess I'm in deep water here:
declare
%rest:path("/download/{$file}")
function page:download-file($file)
{
<rest:response>
<http:response status="200" message="OK">
<http:header name="Content-Disposition" value="Attachment"/>
<http:header name="filename" value="{$file}"/>
</http:response>
</rest:response>
};
This function do trigger a download of a file with the appropriate file name (=$file) containing the text OK. If I just could find somewhere in this code to put the contents of file, it should solve the problem.
Best,
Lars