Created grails-app /domain/csv/ | Created src In grails-app/init/ add a couple of domain class instances. outputStream. Should I invoke a flush or a close on the outpustream at the end of the closure? () or rendering/grails-app/services/grails/plugins/rendering/ protected abstract doRender(Map args, Document document, OutputStream.

Author: Faekora Maushicage
Country: Burma
Language: English (Spanish)
Genre: Spiritual
Published (Last): 21 March 2011
Pages: 183
PDF File Size: 3.25 Mb
ePub File Size: 4.85 Mb
ISBN: 667-2-53598-240-1
Downloads: 18465
Price: Free* [*Free Regsitration Required]
Uploader: Gardajin

Search everywhere only in this topic.

The Grails Framework

Proper way to stream file from controller. Hi all, I have a controller which would stream file as response.

Currently, here’s how I do it: Should Outputstrea invoke a flush or a close on the outpustream at the end of the closure? Are you facing any problems with that?

My code is only a little different, in that I don’t set the “Content-disposition” header and flush afterwards. Anyway, grials is what I do and it works fairly well for me: Lauk To unsubscribe from this list, please visit: I have found it beneficial to use some of the new ‘Groovy’ methods on the File class in particular the File.


If the byte arrays in your examples are large, or if the ‘download’ action is called frequently, you could run into problems. If that’s the case, copy from stream to stream.

Will give this a shot. On Wed, Jul 30, at 9: On Wed, Jul 30, at 1: In reply to this post by Lauk Daniel. What happens is that whenever I access it, Firefox fires up Totem plugin which streams the file from the controller.

I will then get an IllegalStateException: Stream whenever I close the window before the full audio file gets to play.

Other than that, so far things are ok.

On Wed, Jul 30, at 2: Free forum by Nabble.