I have the folowing code:
response.contentType = "application/octet-stream"
response.setContentLength(templateFile.bytes.length)
response.setHeader("Content-disposition", "attachment;filename=${fileName}")
IOUtils.copy(templateFile,response.outputStream)
Where templateFile is Jasper Report template(*.jrxml).
And I always get net::ERR_FILE_NOT_FOUND.
For the different file types this code works fine.
Also i tried with content type ‘text/xml’ but result is the same.
Problem solved after calling flush() on outputStream. Operator << do this implicitly while IOUtils.copy not.