亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? velocityview.java

?? spring framework 2.5.4源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Copyright 2002-2007 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.web.servlet.view.velocity;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.app.tools.VelocityFormatter;
import org.apache.velocity.context.Context;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.tools.generic.DateTool;
import org.apache.velocity.tools.generic.NumberTool;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContextException;
import org.springframework.util.ClassUtils;
import org.springframework.web.servlet.support.RequestContextUtils;
import org.springframework.web.servlet.view.AbstractTemplateView;
import org.springframework.web.util.NestedServletException;

/**
 * View using the Velocity template engine.
 *
 * <p>Exposes the following JavaBean properties:
 * <ul>
 * <li><b>url</b>: the location of the Velocity template to be wrapped,
 * relative to the Velocity resource loader path (see VelocityConfigurer).
 * <li><b>encoding</b> (optional, default is determined by Velocity configuration):
 * the encoding of the Velocity template file
 * <li><b>velocityFormatterAttribute</b> (optional, default=null): the name of
 * the VelocityFormatter helper object to expose in the Velocity context of this
 * view, or <code>null</code> if not needed. VelocityFormatter is part of standard Velocity.
 * <li><b>dateToolAttribute</b> (optional, default=null): the name of the
 * DateTool helper object to expose in the Velocity context of this view,
 * or <code>null</code> if not needed. DateTool is part of Velocity Tools 1.0.
 * <li><b>numberToolAttribute</b> (optional, default=null): the name of the
 * NumberTool helper object to expose in the Velocity context of this view,
 * or <code>null</code> if not needed. NumberTool is part of Velocity Tools 1.1.
 * <li><b>cacheTemplate</b> (optional, default=false): whether or not the Velocity
 * template should be cached. It should normally be true in production, but setting
 * this to false enables us to modify Velocity templates without restarting the
 * application (similar to JSPs). Note that this is a minor optimization only,
 * as Velocity itself caches templates in a modification-aware fashion.
 * </ul>
 *
 * <p>Depends on a VelocityConfig object such as VelocityConfigurer being
 * accessible in the current web application context, with any bean name.
 * Alternatively, you can set the VelocityEngine object as bean property.
 *
 * <p>Note: Spring's VelocityView requires Velocity 1.3 or higher, and optionally
 * Velocity Tools 1.0 or higher (depending on the use of DateTool and/or NumberTool).
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 * @see VelocityConfig
 * @see VelocityConfigurer
 * @see #setUrl
 * @see #setExposeSpringMacroHelpers
 * @see #setEncoding
 * @see #setVelocityEngine
 * @see VelocityConfig
 * @see VelocityConfigurer
 */
public class VelocityView extends AbstractTemplateView {

	private Map toolAttributes;

	private String velocityFormatterAttribute;

	private String dateToolAttribute;

	private String numberToolAttribute;

	private String encoding;

	private boolean cacheTemplate = false;

	private VelocityEngine velocityEngine;

	private Template template;


	/**
	 * Set tool attributes to expose to the view, as attribute name / class name pairs.
	 * An instance of the given class will be added to the Velocity context for each
	 * rendering operation, under the given attribute name.
	 * <p>For example, an instance of MathTool, which is part of the generic package
	 * of Velocity Tools, can be bound under the attribute name "math", specifying the
	 * fully qualified class name "org.apache.velocity.tools.generic.MathTool" as value.
	 * <p>Note that VelocityView can only create simple generic tools or values, that is,
	 * classes with a public default constructor and no further initialization needs.
	 * This class does not do any further checks, to not introduce a required dependency
	 * on a specific tools package.
	 * <p>For tools that are part of the view package of Velocity Tools, a special
	 * Velocity context and a special init callback are needed. Use VelocityToolboxView
	 * in such a case, or override <code>createVelocityContext</code> and
	 * <code>initTool</code> accordingly.
	 * <p>For a simple VelocityFormatter instance or special locale-aware instances
	 * of DateTool/NumberTool, which are part of the generic package of Velocity Tools,
	 * specify the "velocityFormatterAttribute", "dateToolAttribute" or
	 * "numberToolAttribute" properties, respectively.
	 * @param toolAttributes attribute names as keys, and tool class names as values
	 * @see org.apache.velocity.tools.generic.MathTool
	 * @see VelocityToolboxView
	 * @see #createVelocityContext
	 * @see #initTool
	 * @see #setVelocityFormatterAttribute
	 * @see #setDateToolAttribute
	 * @see #setNumberToolAttribute
	 */
	public void setToolAttributes(Properties toolAttributes) {
		this.toolAttributes = new HashMap(toolAttributes.size());
		for (Enumeration attributeNames = toolAttributes.propertyNames(); attributeNames.hasMoreElements();) {
			String attributeName = (String) attributeNames.nextElement();
			String className = toolAttributes.getProperty(attributeName);
			Class toolClass = null;
			try {
				toolClass = ClassUtils.forName(className);
			}
			catch (ClassNotFoundException ex) {
				throw new IllegalArgumentException(
						"Invalid definition for tool '" + attributeName + "' - tool class not found: " + ex.getMessage());
			}
			this.toolAttributes.put(attributeName, toolClass);
		}
	}

	/**
	 * Set the name of the VelocityFormatter helper object to expose in the
	 * Velocity context of this view, or <code>null</code> if not needed.
	 * <p>VelocityFormatter is part of the standard Velocity distribution.
	 * @see org.apache.velocity.app.tools.VelocityFormatter
	 */
	public void setVelocityFormatterAttribute(String velocityFormatterAttribute) {
		this.velocityFormatterAttribute = velocityFormatterAttribute;
	}

	/**
	 * Set the name of the DateTool helper object to expose in the Velocity context
	 * of this view, or <code>null</code> if not needed. The exposed DateTool will be aware of
	 * the current locale, as determined by Spring's LocaleResolver.
	 * <p>DateTool is part of the generic package of Velocity Tools 1.0.
	 * Spring uses a special locale-aware subclass of DateTool.
	 * @see org.apache.velocity.tools.generic.DateTool
	 * @see org.springframework.web.servlet.support.RequestContextUtils#getLocale
	 * @see org.springframework.web.servlet.LocaleResolver
	 */
	public void setDateToolAttribute(String dateToolAttribute) {
		this.dateToolAttribute = dateToolAttribute;
	}

	/**
	 * Set the name of the NumberTool helper object to expose in the Velocity context
	 * of this view, or <code>null</code> if not needed. The exposed NumberTool will be aware of
	 * the current locale, as determined by Spring's LocaleResolver.
	 * <p>NumberTool is part of the generic package of Velocity Tools 1.1.
	 * Spring uses a special locale-aware subclass of NumberTool.
	 * @see org.apache.velocity.tools.generic.NumberTool
	 * @see org.springframework.web.servlet.support.RequestContextUtils#getLocale
	 * @see org.springframework.web.servlet.LocaleResolver
	 */
	public void setNumberToolAttribute(String numberToolAttribute) {
		this.numberToolAttribute = numberToolAttribute;
	}

	/**
	 * Set the encoding of the Velocity template file. Default is determined
	 * by the VelocityEngine: "ISO-8859-1" if not specified otherwise.
	 * <p>Specify the encoding in the VelocityEngine rather than per template
	 * if all your templates share a common encoding.
	 */
	public void setEncoding(String encoding) {
		this.encoding = encoding;
	}

	/**
	 * Return the encoding for the Velocity template.
	 */
	protected String getEncoding() {
		return this.encoding;
	}

	/**
	 * Set whether the Velocity template should be cached. Default is "false".
	 * It should normally be true in production, but setting this to false enables us to
	 * modify Velocity templates without restarting the application (similar to JSPs).
	 * <p>Note that this is a minor optimization only, as Velocity itself caches
	 * templates in a modification-aware fashion.
	 */
	public void setCacheTemplate(boolean cacheTemplate) {
		this.cacheTemplate = cacheTemplate;
	}

	/**
	 * Return whether the Velocity template should be cached.
	 */
	protected boolean isCacheTemplate() {
		return this.cacheTemplate;
	}

	/**
	 * Set the VelocityEngine to be used by this view.
	 * If this is not set, the default lookup will occur: A single VelocityConfig
	 * is expected in the current web application context, with any bean name.
	 * @see VelocityConfig
	 */
	public void setVelocityEngine(VelocityEngine velocityEngine) {
		this.velocityEngine = velocityEngine;
	}

	/**
	 * Return the VelocityEngine used by this view.
	 */
	protected VelocityEngine getVelocityEngine() {
		return this.velocityEngine;
	}


	/**
 	 * Invoked on startup. Looks for a single VelocityConfig bean to
 	 * find the relevant VelocityEngine for this factory.
 	 */
	protected void initApplicationContext() throws BeansException {
		super.initApplicationContext();

		if (getVelocityEngine() == null) {
			// No explicit VelocityEngine: try to autodetect one.
			setVelocityEngine(autodetectVelocityEngine());
		}

		checkTemplate();
	}

	/**
	 * Autodetect a VelocityEngine via the ApplicationContext.
	 * Called if no explicit VelocityEngine has been specified.
	 * @return the VelocityEngine to use for VelocityViews
	 * @throws BeansException if no VelocityEngine could be found
	 * @see #getApplicationContext
	 * @see #setVelocityEngine
	 */
	protected VelocityEngine autodetectVelocityEngine() throws BeansException {
		try {
			VelocityConfig velocityConfig = (VelocityConfig)
					BeanFactoryUtils.beanOfTypeIncludingAncestors(
							getApplicationContext(), VelocityConfig.class, true, false);
			return velocityConfig.getVelocityEngine();
		}
		catch (NoSuchBeanDefinitionException ex) {
			throw new ApplicationContextException(
					"Must define a single VelocityConfig bean in this web application context " +
					"(may be inherited): VelocityConfigurer is the usual implementation. " +
					"This bean may be given any name.", ex);
		}
	}

	/**
	 * Check that the Velocity template used for this view exists and is valid.
	 * <p>Can be overridden to customize the behavior, for example in case of
	 * multiple templates to be rendered into a single view.
	 * @throws ApplicationContextException if the template cannot be found or is invalid
	 */
	protected void checkTemplate() throws ApplicationContextException {
		try {
			// Check that we can get the template, even if we might subsequently get it again.
			this.template = getTemplate();
		}
		catch (ResourceNotFoundException ex) {
			throw new ApplicationContextException("Cannot find Velocity template for URL [" + getUrl() +
				"]: Did you specify the correct resource loader path?", ex);
		}
		catch (Exception ex) {
			throw new ApplicationContextException(
					"Could not load Velocity template for URL [" + getUrl() + "]", ex);
		}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看视频欧美| 欧美挠脚心视频网站| 欧美一级二级三级蜜桃| 中文字幕字幕中文在线中不卡视频| 亚洲成人激情社区| 99久久久精品| 久久婷婷综合激情| 免费的国产精品| 在线不卡免费av| 亚洲自拍偷拍综合| 色菇凉天天综合网| 亚洲午夜影视影院在线观看| 91网页版在线| 亚洲精品国产视频| 在线一区二区视频| 国产精品理论片在线观看| 成人美女在线观看| 欧美激情一区二区三区蜜桃视频| 麻豆精品视频在线观看免费| 日韩欧美国产一区二区三区| 免费在线观看精品| 精品美女一区二区| 另类的小说在线视频另类成人小视频在线 | 麻豆成人久久精品二区三区小说| 欧美在线高清视频| 一区二区三区在线视频播放| 成人高清伦理免费影院在线观看| 国产欧美日韩在线观看| 色哟哟日韩精品| 秋霞成人午夜伦在线观看| 精品少妇一区二区三区日产乱码| 国产精品69毛片高清亚洲| 久久亚洲精精品中文字幕早川悠里 | 粉嫩aⅴ一区二区三区四区五区 | 欧美专区日韩专区| 免费观看久久久4p| 日韩一区中文字幕| 精品三级在线看| 91视频国产观看| 久久99最新地址| 亚洲第一在线综合网站| 91精品免费在线| 不卡一区中文字幕| 激情五月激情综合网| 一区二区三区不卡视频| 国产亚洲欧美中文| 精品sm捆绑视频| 91精品免费观看| 欧美日韩中文字幕精品| av电影在线不卡| 激情图区综合网| 久久综合综合久久综合| 视频一区中文字幕国产| 亚洲成人激情综合网| 亚洲男人的天堂在线观看| 日本一区二区三区国色天香| 久久麻豆一区二区| 久久久91精品国产一区二区精品| 欧美卡1卡2卡| 日韩欧美第一区| 欧美变态凌虐bdsm| 久久影院电视剧免费观看| 精品国产乱码久久久久久蜜臀| 8x福利精品第一导航| 91麻豆精品国产综合久久久久久| 欧美中文字幕亚洲一区二区va在线| 99久久99久久精品免费看蜜桃| 成人黄色电影在线| 91色综合久久久久婷婷| 日韩精品中文字幕一区二区三区| 欧美日高清视频| 日韩一区二区精品在线观看| 精品国产制服丝袜高跟| 亚洲欧洲三级电影| 亚洲欧美另类图片小说| 一区二区在线观看av| 日韩高清在线一区| 国产精品一区在线| 色狠狠色狠狠综合| 久久久久国产精品免费免费搜索| 中文字幕字幕中文在线中不卡视频| 亚洲天天做日日做天天谢日日欢 | 国模大尺度一区二区三区| 亚洲综合久久久久| 精东粉嫩av免费一区二区三区| 国产精品77777竹菊影视小说| 色综合色综合色综合| 日韩一区二区在线观看视频| 亚洲欧洲精品一区二区三区不卡| 亚洲成人综合视频| jlzzjlzz欧美大全| 日韩免费观看高清完整版| 怡红院av一区二区三区| 精久久久久久久久久久| 欧美精品三级在线观看| 国产精品成人网| 懂色av中文字幕一区二区三区| 91精品国产综合久久香蕉麻豆 | 91精品国产欧美一区二区成人| 国产精品嫩草久久久久| 国产一二三精品| 欧美一区二区三区免费大片 | 欧美一区二区三区啪啪| 无吗不卡中文字幕| 欧美亚日韩国产aⅴ精品中极品| 国产欧美一区二区三区在线老狼| 久久精品噜噜噜成人88aⅴ| 色婷婷综合久久久中文一区二区| 国产精品热久久久久夜色精品三区| 狠狠色综合播放一区二区| 91精品国产欧美一区二区18| 日本不卡一二三区黄网| 91精品国产综合久久精品性色| 午夜免费久久看| 欧美日韩中文字幕一区| 久久精品国产精品青草| 久久久久久99精品| bt7086福利一区国产| 一区二区三区免费观看| 欧美日韩久久久| 免费成人性网站| 国产三级精品三级| 欧美在线观看一区二区| 日韩国产高清在线| 成人欧美一区二区三区1314 | 99re在线视频这里只有精品| 一区二区免费在线播放| 欧美哺乳videos| 色婷婷综合在线| 另类小说欧美激情| 亚洲免费在线电影| 久久免费美女视频| 欧美色爱综合网| 成人性生交大片免费看中文| 亚洲午夜视频在线观看| 精品精品欲导航| 欧美三级视频在线| 99视频精品在线| 国产不卡免费视频| 欧美精品一区二| www.欧美日韩| 久久精品久久99精品久久| 亚洲色欲色欲www在线观看| 日韩欧美你懂的| 91精品国产麻豆| 色婷婷综合视频在线观看| 国产麻豆精品久久一二三| 天天综合天天做天天综合| 日韩码欧中文字| 日韩美女啊v在线免费观看| 26uuu亚洲| 欧美精品一区二区蜜臀亚洲| 91精品国产福利| 欧美一级艳片视频免费观看| 欧美中文字幕不卡| 欧美日韩久久不卡| 日韩一级成人av| 日韩小视频在线观看专区| 91精品国产一区二区| 日韩免费一区二区| 欧美人动与zoxxxx乱| 欧美一级精品大片| 精品国产伦一区二区三区观看方式 | 美脚の诱脚舐め脚责91| 美脚の诱脚舐め脚责91| 国产一区二区三区av电影| 国产美女在线精品| 99久久精品国产网站| 在线欧美日韩精品| 欧美高清激情brazzers| 欧美α欧美αv大片| 久久久高清一区二区三区| 中文字幕一区二区三区在线观看 | 国产精品66部| 91久久国产综合久久| 欧美日韩国产综合草草| 欧美日免费三级在线| 国产女同性恋一区二区| 亚洲激情校园春色| 久久精品国产久精国产| 99在线精品观看| 久久众筹精品私拍模特| 亚洲一区二区三区在线播放| 国产毛片精品一区| 欧美精品在线观看播放| 国产精品女人毛片| 久久99精品视频| 日本丰满少妇一区二区三区| 久久久久高清精品| 日韩精品电影在线| 欧美在线一区二区| 国产欧美一区视频| 国产精品一区二区不卡| 欧美久久久久久久久| 亚洲高清不卡在线观看| 成人成人成人在线视频| 国产亚洲人成网站| 国产激情一区二区三区四区 | 国产成人av一区二区三区在线观看| 成人av网站免费观看|