Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Duplicate
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
This comes up quite often and many plugins implement their own version of this. It's not as trivial as it might appear at first glance as their are certain considerations such as encoding, stream copying and request binding to take care of.
First thoughts on API would be a new bean (e.g. gspRenderer) that exposes a render() method that has similar semantics to the render() method available on controllers.
Plugins such as mail, rendering etc. that write their own version of this should be encouraged to use this new API.
Issue Links
- duplicates
-
GRAILS-3818
Make rendering operations (views, templates etc.) possible on non request threads and from services and other beans
-
- is related to
-
GRAILS-5560
GroovyPagesTemplateEngine does not cache compiled templates for several variants of createTemplate
-
These two issues are related in that pragmatically only one of them needs to be implemented.
If it is not practical to render views without a request environment, there should be a centralised, supported, way of doing this on non request threads.
There are several plugins that do this (quartz, mail, rendering) and they ALL do it wrong.