/** * Invoked on startup. Looks for a single FreeMarkerConfig bean to * find the relevant Configuration for this factory. * <p>Checks that the template for the default Locale can be found: * FreeMarker will check non-Locale-specific templates if a * locale-specific one is not found. * @see freemarker.cache.TemplateCache#getTemplate */ @Override protected void initServletContext(ServletContext servletContext) throws BeansException { if (getConfiguration() != null) { this.taglibFactory = new TaglibFactory(servletContext); } else { FreeMarkerConfig config = autodetectConfiguration(); setConfiguration(config.getConfiguration()); this.taglibFactory = config.getTaglibFactory(); } GenericServlet servlet = new GenericServletAdapter(); try { servlet.init(new DelegatingServletConfig()); } catch (ServletException ex) { throw new BeanInitializationException("Initialization of GenericServlet adapter failed", ex); } this.servletContextHashModel = new ServletContextHashModel(servlet, getObjectWrapper()); }
this.servlet = ((ServletContextHashModel) appModel).getServlet(); } else { throw new TemplateModelException("Could not find an instance of " +
synchronized (lazyInitFieldsLock) { if (this.servletContextModel == null) { servletContextModel = new ServletContextHashModel(this, objectWrapper); taglibFactory = createTaglibFactory(objectWrapper, servletContext);
this.servlet = ((ServletContextHashModel)appModel).getServlet();
/** * Invoked on startup. Looks for a single FreeMarkerConfig bean to * find the relevant Configuration for this factory. * <p>Checks that the template for the default Locale can be found: * FreeMarker will check non-Locale-specific templates if a * locale-specific one is not found. * @see freemarker.cache.TemplateCache#getTemplate */ @Override protected void initServletContext(ServletContext servletContext) throws BeansException { if (getConfiguration() != null) { this.taglibFactory = new TaglibFactory(servletContext); } else { FreeMarkerConfig config = autodetectConfiguration(); setConfiguration(config.getConfiguration()); this.taglibFactory = config.getTaglibFactory(); } GenericServlet servlet = new GenericServletAdapter(); try { servlet.init(new DelegatingServletConfig()); } catch (ServletException ex) { throw new BeanInitializationException("Initialization of GenericServlet adapter failed", ex); } this.servletContextHashModel = new ServletContextHashModel(servlet, getObjectWrapper()); }
this.servlet = ((ServletContextHashModel) appModel).getServlet(); } else { throw new TemplateModelException("Could not find an instance of " +
protected ServletContextHashModel checkServletContextModel(ServletContext servletContext) throws ServletException { if (servletContextHashModel == null) { // FreeMarker needs an instance of a GenericServlet, but it doesn't have to do anything other than provide references to the ServletContext final GenericServlet fs = new DoNothingServlet(servletContext); servletContextHashModel = new ServletContextHashModel(fs, cfg.getObjectWrapper()); } return servletContextHashModel; }
this.servlet = ((ServletContextHashModel) appModel).getServlet(); } else { throw new TemplateModelException("Could not find an instance of " +
GenericServlet servlet = JspSupportServlet.jspSupportServlet; if (!Lang.isEmpty(servlet)) { servletContextModel = new ServletContextHashModel(servlet, wrapper); servletContext.setAttribute(ATTR_APPLICATION_MODEL, servletContextModel); TaglibFactory taglibs = new TaglibFactory(servletContext);
/** * <p>Instantiates a new instance of <code>ServletContextHashModel</code>.</p> * @return ServletContextHashModel */ public ServletContextHashModel getServletContextHashModel() { // build the servlet context hash model GenericServlet servlet = new GenericServletAdapter(); try { servlet.init(new DelegatingServletConfig(servletContext)); } catch (ServletException ex) { throw new BeanInitializationException("Initialization of GenericServlet adapter failed", ex); } ServletContextHashModel servletContextHashModel = new ServletContextHashModel(servlet, ObjectWrapper.DEFAULT_WRAPPER); return servletContextHashModel; }
/** * <p>Instantiates a new instance of <code>ServletContextHashModel</code>.</p> * @return ServletContextHashModel */ public ServletContextHashModel getServletContextHashModel() { // build the servlet context hash model GenericServlet servlet = new GenericServletAdapter(); try { servlet.init(new DelegatingServletConfig(servletContext)); } catch (ServletException ex) { throw new BeanInitializationException("Initialization of GenericServlet adapter failed", ex); } ServletContextHashModel servletContextHashModel = new ServletContextHashModel(servlet, ObjectWrapper.DEFAULT_WRAPPER); return servletContextHashModel; }
servletContextModel = new ServletContextHashModel(servlet, wrapper); servletContext.setAttribute(ATTR_APPLICATION_MODEL, servletContextModel); TaglibFactory taglibs = new TaglibFactory(servletContext);
request.setAttribute("_REQUEST_HANDLER_", handler); ServletContextHashModel ftlServletContext = new ServletContextHashModel(this, FreeMarkerWorker.getDefaultOfbizWrapper()); request.setAttribute("ftlServletContext", ftlServletContext);
if (servletContextModel == null) servletContextModel = new ServletContextHashModel(this, wrapper); servletContext.setAttribute( ATTR_APPLICATION_MODEL,
/** * JSP taglib support */ public void loadJspTaglib(GenericServlet servlet) { if (rendering instanceof FreemarkerEngine) { FreemarkerEngine fm = (FreemarkerEngine) rendering; ServletContextHashModel servletContextModel = new ServletContextHashModel(servlet, fm.getObjectWrapper()); fm.setSharedVariable("Application", servletContextModel); fm.setSharedVariable("__FreeMarkerServlet.Application__", servletContextModel); fm.setSharedVariable("Application", servletContextModel); fm.setSharedVariable("__FreeMarkerServlet.Application__", servletContextModel); fm.setSharedVariable("JspTaglibs", new TaglibFactory(servlet.getServletContext())); } }
synchronized (lazyInitFieldsLock) { if (this.servletContextModel == null) { servletContextModel = new ServletContextHashModel(this, objectWrapper); taglibFactory = createTaglibFactory(objectWrapper, servletContext);
synchronized (lazyInitFieldsLock) { if (this.servletContextModel == null) { servletContextModel = new ServletContextHashModel(this, objectWrapper); taglibFactory = createTaglibFactory(objectWrapper, servletContext);
/** * Invoked on startup. Looks for a single FreeMarkerConfig bean to * find the relevant Configuration for this factory. * <p>Checks that the template for the default Locale can be found: * FreeMarker will check non-Locale-specific templates if a * locale-specific one is not found. * @see freemarker.cache.TemplateCache#getTemplate */ @Override protected void initServletContext(ServletContext servletContext) throws BeansException { if (getConfiguration() != null) { this.taglibFactory = new TaglibFactory(servletContext); } else { FreeMarkerConfig config = autodetectConfiguration(); setConfiguration(config.getConfiguration()); this.taglibFactory = config.getTaglibFactory(); } GenericServlet servlet = new GenericServletAdapter(); try { servlet.init(new DelegatingServletConfig()); } catch (ServletException ex) { throw new BeanInitializationException("Initialization of GenericServlet adapter failed", ex); } this.servletContextHashModel = new ServletContextHashModel(servlet, getObjectWrapper()); }
/** * Invoked on startup. Looks for a single FreeMarkerConfig bean to * find the relevant Configuration for this factory. * <p>Checks that the template for the default Locale can be found: * FreeMarker will check non-Locale-specific templates if a * locale-specific one is not found. * @see freemarker.cache.TemplateCache#getTemplate */ @Override protected void initServletContext(ServletContext servletContext) throws BeansException { if (getConfiguration() != null) { this.taglibFactory = new TaglibFactory(servletContext); } else { FreeMarkerConfig config = autodetectConfiguration(); setConfiguration(config.getConfiguration()); this.taglibFactory = config.getTaglibFactory(); } GenericServlet servlet = new GenericServletAdapter(); try { servlet.init(new DelegatingServletConfig()); } catch (ServletException ex) { throw new BeanInstanceException("Initialization of GenericServlet adapter failed", ex); } this.servletContextHashModel = new ServletContextHashModel(servlet, getObjectWrapper()); }