Currently, this is handled by overriding the getTemplate() method in the FreemarkerConfiguration, and storing the result in the environment. Since the top-level template is loaded prior to the environment being created, a similar process occurs in TemplateProcessingHelper.
How could this be done more cleanly?
The DataGetter interface returns a full map. Could it be changed to just return the map of changes/additions? Could we treat it as such? Could these be stored in the request-based info in the Configuration?