use of freemarker.ext.servlet.ServletContextHashModel in project entando-core by entando.
the class ControllerServlet method createModel.
@Override
protected TemplateModel createModel(ObjectWrapper wrapper, ServletContext servletContext, HttpServletRequest request, HttpServletResponse response) throws TemplateModelException {
TemplateModel template = super.createModel(wrapper, servletContext, request, response);
if (template instanceof AllHttpScopesHashModel) {
AllHttpScopesHashModel hashModel = ((AllHttpScopesHashModel) template);
ServletContextHashModel servletContextModel = (ServletContextHashModel) hashModel.get(KEY_APPLICATION);
if (null == servletContextModel.getServlet()) {
ServletContextHashModel newServletContextModel = new ServletContextHashModel(this, wrapper);
servletContextModel = new ServletContextHashModel(this, wrapper);
servletContext.setAttribute(ATTR_APPLICATION_MODEL, servletContextModel);
TaglibFactory taglibs = new TaglibFactory(servletContext);
servletContext.setAttribute(ATTR_JSP_TAGLIBS_MODEL, taglibs);
hashModel.putUnlistedModel(KEY_APPLICATION, newServletContextModel);
hashModel.putUnlistedModel(KEY_APPLICATION_PRIVATE, newServletContextModel);
}
}
return template;
}
Aggregations