Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
None
Description
If a freemarker template, containing a head contribution tag, is invoked in HST Resource URL serving phase, it throws an UnsupportedOperationException because the HstResourceResponse does not support operations such as #containsHeadElement(...).
That makes sense.
However, it might be better and more useful if the head contribution tag (<@hst.headContribution/>) simply skips its default behavior if HstRequest#getLifecyclePhase() doesn't equal to "RENDER_PHASE", not to invoke any unsupported operations on HstResponse.
In projects, sometimes it is very hard to find the root cause if the head contribution tags are nested in a freemarker macros with some conditions. Sometimes it's working, sometimes not working as a result.
A small improvement like this would help avoid any extra effort in projects.