Description
During development with repository-stored freemarker templates, we found that sometimes the changes are not refreshed automatically.
Sometimes it looks working fine but some time later, it isn't refreshed. There's no clear reproducing steps available.
So, I looked into HstFreemarkerServlet and RepositoryTemplateLoader class to guess some possible cases.
IMO, there are two possible cases:
- When the cms is restarted, the event listener will not work any more.
- When the session is not valid any more for some reason in the repository side, the event listener will not work.
Currently, RepositoryTemplateLoader registers a observation event listener at initilalization.
However, it doesn't check if the session is valid periodically. And it doesn't remove the registered listener after all.
So, I'd like to suggest the following:
(1) Check the session validity periodically as being done in EventListenersContainerImpl
(2) When the HstFreemarkerServlet is destroyed, remove the registered listeners.