Want to include some static files into your Grails application? For example some document templates in order to be used by Freemarker, XDocReport etc?
You can:
info: Don't forget to restart webapp (stop and run-app) to allow Grails to redeploy (including your resources)
This works for Grails 2.2.2
You can:
- create a package into conf/ eg named templates
- put your files into conf/templates
- reference the files from a service or controller using
this.class.getClassLoader().getResourceAsStream("templates/invoiceTemplate.docx");
or
this.class.getClassLoader().getResource("templates/invoiceTemplate.docx");
info: Don't forget to restart webapp (stop and run-app) to allow Grails to redeploy (including your resources)
This works for Grails 2.2.2
No comments:
Post a Comment