generate a file on the fly and provide it as download.
Well the easiest solution was to just create a closure in a controller and set the content type in there.
def download = {
File file = new File(params.file)
response.setHeader "Content-disposition", "attachment; filename=${file.name}.txt"
response.contentType = 'text-plain'
response.outputStream << file.text response.outputStream.flush() }
No comments:
Post a Comment