Details
-
New Feature
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
None
Description
Add the following API:
HstRequest#setModel(String name, Object model); <T> T HstRequest#getModel(String name); Enumeration<String> HstRequest#getModelNames(); Map<String, Object> HstRequest#getModelsMap();
Also, HstRequest#getAttribute(name) should fall back to #getModel(name) when no request attribute is found. Otherwise, any access to the model in JSP/FreeMarker (which convert request attributes to the models in view automatically) can fail.
And, HstRequest#getAttributeNames() should combine model names for the same reason.
The same pattern applies to HstRequestContext.
By providing the APIs in both HstRequest and HstRequestContext, a component can decide where to contribute. The former one is supposed to be non-global ones whereas the latter one is supposed to be global one in the request processing.