use of org.entando.entando.aps.servlet.ControllerServlet in project entando-core by entando.
the class AbstractTestExecutorService method createModel.
protected TemplateModel createModel(ObjectWrapper wrapper) throws Throwable {
HttpServletRequest request = super.getRequestContext().getRequest();
HttpServletResponse response = super.getRequestContext().getResponse();
ServletContext servletContext = request.getSession().getServletContext();
// super.createModel(wrapper, servletContext, request, response);
AllHttpScopesHashModel hashModel = new AllHttpScopesHashModel(wrapper, servletContext, request);
ControllerServlet servlet = new ControllerServlet();
MockServletConfig config = new MockServletConfig(servletContext);
servlet.init(config);
ServletContextHashModel newServletContextModel = new ServletContextHashModel(servlet, wrapper);
ServletContextHashModel servletContextModel = new ServletContextHashModel(servlet, wrapper);
servletContext.setAttribute(ATTR_APPLICATION_MODEL, servletContextModel);
TaglibFactory taglibs = new TaglibFactory(servletContext);
servletContext.setAttribute(ATTR_JSP_TAGLIBS_MODEL, taglibs);
hashModel.putUnlistedModel(FreemarkerServlet.KEY_APPLICATION, newServletContextModel);
hashModel.putUnlistedModel(FreemarkerServlet.KEY_APPLICATION_PRIVATE, newServletContextModel);
hashModel.putUnlistedModel(FreemarkerServlet.KEY_JSP_TAGLIBS, taglibs);
HttpRequestHashModel requestModel = new HttpRequestHashModel(request, response, wrapper);
request.setAttribute(ATTR_REQUEST_MODEL, requestModel);
hashModel.putUnlistedModel(FreemarkerServlet.KEY_REQUEST_PRIVATE, requestModel);
return hashModel;
}
Aggregations