Search in sources :

Example 1 with GenericServlet

use of javax.servlet.GenericServlet in project spring-framework by spring-projects.

the class FreeMarkerView method initServletContext.

/**
	 * 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());
}
Also used : ServletException(javax.servlet.ServletException) BeanInitializationException(org.springframework.beans.factory.BeanInitializationException) GenericServlet(javax.servlet.GenericServlet) ServletContextHashModel(freemarker.ext.servlet.ServletContextHashModel) TaglibFactory(freemarker.ext.jsp.TaglibFactory)

Aggregations

TaglibFactory (freemarker.ext.jsp.TaglibFactory)1 ServletContextHashModel (freemarker.ext.servlet.ServletContextHashModel)1 GenericServlet (javax.servlet.GenericServlet)1 ServletException (javax.servlet.ServletException)1 BeanInitializationException (org.springframework.beans.factory.BeanInitializationException)1