Grails Programmer: How to output CSV from a Grails 3 Controller. 20 / 1 Reply def outs = Stream. = (). response. Should I invoke a flush or a close on the outpustream at the end of the closure? () or GRAILS IllegalStateException error for return the Stream # Closed. graemerocher opened this Issue on Oct 29, ยท 0 comments.

Author: Kazishura Mijora
Country: Martinique
Language: English (Spanish)
Genre: Art
Published (Last): 17 August 2014
Pages: 465
PDF File Size: 5.42 Mb
ePub File Size: 20.8 Mb
ISBN: 962-3-29722-214-1
Downloads: 99828
Price: Free* [*Free Regsitration Required]
Uploader: Shagami

Grails Goodness: Render Binary Output with the File Attribute – Messages from mrhaki

The BootStrap init closure runs when the app starts. Outpuhstream I will recommend to put the logic fetching the lines in a Service.

B I am using the mime type and encoding defined in application. Learn more about retrieving config values. C If you want the file to download you need to setup the Content-disposition header.


CSV is probably the best format to export your data from a Grails App. A CSV file is easy to import in Excel.

Grails User (Old Archive) – Proper way to stream file from controller

I was tired of my clients asking me how to import a CSV in Excel. I wrote a post; in Spanish though.

If the answer is yes, subscribe to Groovy Calamari. A weekly curated email newsletter about the Groovy ecosystem. Your email address will not be published.

Notify me of follow-up comments by email. Notify me of new posts by email. Dynamic Productivity for the Java Developer’, author: Use TAB for completion: GrailsConfigurationAware import static org. If we run the app and call the controller we will download a CSV file as this: Thanks If you are using Grails 2, just change the setConfiguration part to this: Leave a Reply Cancel reply Your email address will not be published.