亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
2023国产精品| 欧美日韩黄色影视| 久久99在线观看| 首页国产欧美日韩丝袜| 亚洲观看高清完整版在线观看| 亚洲免费色视频| 亚洲一区二区综合| 日韩av电影免费观看高清完整版在线观看 | 亚洲与欧洲av电影| 亚洲一区在线看| 丝袜诱惑制服诱惑色一区在线观看| 亚洲1区2区3区4区| 久久国产精品无码网站| 处破女av一区二区| 91在线观看高清| 欧美日韩亚洲综合| 欧美一区二区三区婷婷月色| 欧美成人精品3d动漫h| 欧美激情一区二区三区| 亚洲欧洲av色图| 香蕉乱码成人久久天堂爱免费| 人人爽香蕉精品| eeuss鲁片一区二区三区在线观看| 91在线视频免费观看| 欧美日韩一区二区三区免费看 | 国产日韩欧美制服另类| 欧洲一区二区av| 717成人午夜免费福利电影| 欧美成人女星排行榜| 日韩三级视频中文字幕| 26uuu国产在线精品一区二区| 国产精品久久久久久亚洲毛片| 五月激情丁香一区二区三区| 国产成人精品免费看| 欧美另类高清zo欧美| 欧美经典一区二区| 日韩成人精品在线观看| eeuss影院一区二区三区| 91精品国产欧美日韩| 亚洲婷婷综合色高清在线| 日韩在线一区二区三区| gogogo免费视频观看亚洲一| 日韩欧美成人一区| 一区二区三区在线免费播放| 国产一区二区在线电影| 欧美情侣在线播放| 亚洲日本韩国一区| 国产美女视频91| 精品免费日韩av| 五月综合激情日本mⅴ| 91浏览器入口在线观看| 国产欧美日韩亚州综合| 久久国产精品99久久人人澡| 欧美日韩一本到| 一区二区三区 在线观看视频| 国产麻豆9l精品三级站| 91精品国产乱| 亚洲成人福利片| 欧美在线视频日韩| 亚洲乱码国产乱码精品精98午夜 | 欧美一二三区精品| 亚洲一区二区三区小说| 成人国产精品视频| 欧美激情在线看| 大白屁股一区二区视频| 久久九九全国免费| 国产自产v一区二区三区c| 日韩精品最新网址| 日产国产高清一区二区三区 | 久久综合成人精品亚洲另类欧美 | 中文字幕乱码久久午夜不卡| 五月天一区二区| 99热精品国产| 国产午夜精品久久久久久久| 偷窥少妇高潮呻吟av久久免费| 色哟哟在线观看一区二区三区| 中文字幕免费一区| 国产成人小视频| 久久这里都是精品| 免费欧美高清视频| 欧美日本国产视频| 亚洲国产aⅴ天堂久久| 在线看日韩精品电影| 亚洲乱码日产精品bd| 成人毛片老司机大片| 2023国产精品视频| 国模娜娜一区二区三区| 精品福利av导航| 精品一区二区三区免费播放| 欧美成人三级在线| 国内精品视频666| 日韩免费视频一区| 韩国在线一区二区| 久久久91精品国产一区二区三区| 青娱乐精品在线视频| 日韩欧美国产一区二区在线播放| 免费高清成人在线| 久久亚洲欧美国产精品乐播| 激情综合五月天| 国产精品久久久久久久第一福利 | 久久影音资源网| 国产成a人亚洲| 国产精品美日韩| www.成人网.com| 一区二区三区在线免费视频| 91黄色免费版| 亚洲第一激情av| 欧美成人女星排行榜| 国产91精品欧美| 中文字幕亚洲成人| 色呦呦网站一区| 日本v片在线高清不卡在线观看| 日韩欧美亚洲一区二区| 国产电影一区在线| 一区二区三区中文字幕| 91精品欧美福利在线观看| 人禽交欧美网站| 国产精品午夜春色av| 欧美在线观看你懂的| 免费高清不卡av| 日韩精品一二区| 亚洲精品欧美综合四区| 欧美不卡一区二区三区四区| 97久久超碰国产精品电影| 日本免费新一区视频| 亚洲免费色视频| 国产精品丝袜久久久久久app| 日韩一区二区免费电影| 欧美在线看片a免费观看| 99视频精品全部免费在线| 国产一区二区不卡在线| 九色综合狠狠综合久久| 亚洲成人av一区二区三区| 亚洲图片激情小说| 日本一区二区三区在线观看| 亚洲精品一线二线三线无人区| 欧美日韩精品三区| 欧美在线观看18| 日本道色综合久久| 亚洲网友自拍偷拍| 国产一区二区免费视频| 日韩美女主播在线视频一区二区三区| 波多野结衣一区二区三区| 免费观看久久久4p| 久久久精品综合| 欧美色手机在线观看| 99久精品国产| 成人h精品动漫一区二区三区| 美国精品在线观看| 樱花草国产18久久久久| 国产女同性恋一区二区| 精品国产sm最大网站| 欧美日本在线视频| 欧美亚洲动漫精品| 国产一区二区0| 亚洲精品国产成人久久av盗摄| 色丁香久综合在线久综合在线观看| 精品国产乱码久久久久久图片 | 国产精品一品二品| 亚洲一区二区三区国产| 欧美无乱码久久久免费午夜一区| 日韩—二三区免费观看av| 国产女人18毛片水真多成人如厕| 一本色道亚洲精品aⅴ| 国产在线视频一区二区三区| 亚洲在线观看免费视频| 久久久99免费| 国产成人在线视频网站| 肉肉av福利一精品导航| 中文在线一区二区| 99精品视频在线观看免费| 亚洲一级二级在线| 精品久久国产老人久久综合| 日本不卡一二三| 亚洲男人的天堂av| 欧美在线观看你懂的| 美日韩黄色大片| 亚洲一卡二卡三卡四卡| 欧美一级一区二区| 国产永久精品大片wwwapp| 亚洲欧洲精品天堂一级| 欧美日韩免费观看一区二区三区| 国产激情精品久久久第一区二区 | 国产精品久久久久一区二区三区| 欧美久久高跟鞋激| 成人黄色国产精品网站大全在线免费观看| 午夜久久久久久| 日韩电影一区二区三区| 午夜精品免费在线| 美日韩一区二区| 成人听书哪个软件好| 蜜桃免费网站一区二区三区| 午夜视黄欧洲亚洲| 久久不见久久见免费视频1| 国产福利91精品一区二区三区| 91在线免费看| 91精品国产色综合久久不卡电影| 欧美日韩国产免费一区二区| 欧美一区二区三区公司| 欧美精品电影在线播放|