Example from mailing list:
If I have a controller say:
def genFile {
ByteArrayOutputStream out = new ByteArrayOutputStream();
.... read data into outputstream here
response.setContentType('application/exe')
out.writeTo(response.getOutputStream())
out.close()
}
The file name presented to the user for save would be 'genFile'
However, adding the following in the beginning of controller would force the browser to recognize a different name:
response.addHeader("content-disposition", "attachment;filename=myfilename.ext")
Saturday, April 12, 2008
Subscribe to:
Post Comments (Atom)
2 comments:
Sorry, I intended to comment on your Hudson with Grails post.
Post a Comment