javax.servlet.GenericServlet#init ( )源码实例Demo

下面列出了javax.servlet.GenericServlet#init ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spring-analysis-note   文件: FreeMarkerView.java
/**
 * 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());
}
 
源代码2 项目: java-technology-stack   文件: FreeMarkerView.java
/**
 * 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());
}
 
源代码3 项目: lams   文件: FreeMarkerView.java
/**
 * 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());
}
 
源代码4 项目: spring4-understanding   文件: FreeMarkerView.java
/**
 * 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());
}
 
源代码5 项目: rice   文件: FreeMarkerInlineRenderBootstrap.java
/**
 * Initialize FreeMarker elements after servlet context and FreeMarker configuration have both
 * been populated.
 */
private static void finishConfig() {
    if (freeMarkerConfig != null && servletContext != null) {
        taglibFactory = new TaglibFactory(servletContext);
        
        objectWrapper = freeMarkerConfig.getObjectWrapper();
        if (objectWrapper == null) {
            objectWrapper = ObjectWrapper.DEFAULT_WRAPPER;
        }

        GenericServlet servlet = new ServletAdapter();
        try {
            servlet.init(new DelegatingServletConfig());
        } catch (ServletException ex) {
            throw new BeanInitializationException("Initialization of GenericServlet adapter failed", ex);
        }
        
        servletContextHashModel = new ServletContextHashModel(servlet, ObjectWrapper.DEFAULT_WRAPPER);
        
        LOG.info("Freemarker configuration complete");
    }
}
 
 方法所在类
 同类方法