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

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

?? velocityview.java

?? spring framework 2.5.4源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
	}


	/**
	 * Process the model map by merging it with the Velocity template.
	 * Output is directed to the servlet response.
	 * <p>This method can be overridden if custom behavior is needed.
	 */
	protected void renderMergedTemplateModel(
			Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {

		exposeHelpers(model, request);

		Context velocityContext = createVelocityContext(model, request, response);
		exposeHelpers(velocityContext, request, response);
		exposeToolAttributes(velocityContext, request);

		doRender(velocityContext, response);
	}

	/**
	 * Expose helpers unique to each rendering operation. This is necessary so that
	 * different rendering operations can't overwrite each other's formats etc.
	 * <p>Called by <code>renderMergedTemplateModel</code>. The default implementation
	 * is empty. This method can be overridden to add custom helpers to the model.
	 * @param model the model that will be passed to the template for merging
	 * @param request current HTTP request
	 * @throws Exception if there's a fatal error while we're adding model attributes
	 * @see #renderMergedTemplateModel
	 */
	protected void exposeHelpers(Map model, HttpServletRequest request) throws Exception {
	}

	/**
	 * Create a Velocity Context instance for the given model,
	 * to be passed to the template for merging.
	 * <p>The default implementation delegates to {@link #createVelocityContext(Map)}.
	 * Can be overridden for a special context class, for example ChainedContext which
	 * is part of the view package of Velocity Tools. ChainedContext is needed for
	 * initialization of ViewTool instances.
	 * <p>Have a look at {@link VelocityToolboxView}, which pre-implements
	 * ChainedContext support. This is not part of the standard VelocityView class
	 * in order to avoid a required dependency on the view package of Velocity Tools.
	 * @param model the model Map, containing the model attributes to be exposed to the view
	 * @param request current HTTP request
	 * @param response current HTTP response
	 * @return the Velocity Context
	 * @throws Exception if there's a fatal error while creating the context
	 * @see #createVelocityContext(Map)
	 * @see #initTool
	 * @see org.apache.velocity.tools.view.context.ChainedContext
	 * @see VelocityToolboxView
	 */
	protected Context createVelocityContext(
			Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {

		return createVelocityContext(model);
	}

	/**
	 * Create a Velocity Context instance for the given model,
	 * to be passed to the template for merging.
	 * <p>Default implementation creates an instance of Velocity's
	 * VelocityContext implementation class.
	 * @param model the model Map, containing the model attributes
	 * to be exposed to the view
	 * @return the Velocity Context
	 * @throws Exception if there's a fatal error while creating the context
	 * @see org.apache.velocity.VelocityContext
	 */
	protected Context createVelocityContext(Map model) throws Exception {
		return new VelocityContext(model);
	}

	/**
	 * Expose helpers unique to each rendering operation. This is necessary so that
	 * different rendering operations can't overwrite each other's formats etc.
	 * <p>Called by <code>renderMergedTemplateModel</code>. Default implementation
	 * delegates to <code>exposeHelpers(velocityContext, request)</code>. This method
	 * can be overridden to add special tools to the context, needing the servlet response
	 * to initialize (see Velocity Tools, for example LinkTool and ViewTool/ChainedContext).
	 * @param velocityContext Velocity context that will be passed to the template
	 * @param request current HTTP request
	 * @param response current HTTP response
	 * @throws Exception if there's a fatal error while we're adding model attributes
	 * @see #exposeHelpers(org.apache.velocity.context.Context, HttpServletRequest)
	 */
	protected void exposeHelpers(
			Context velocityContext, HttpServletRequest request, HttpServletResponse response) throws Exception {

		exposeHelpers(velocityContext, request);
	}

	/**
	 * Expose helpers unique to each rendering operation. This is necessary so that
	 * different rendering operations can't overwrite each other's formats etc.
	 * <p>Default implementation is empty. This method can be overridden to add
	 * custom helpers to the Velocity context.
	 * @param velocityContext Velocity context that will be passed to the template
	 * @param request current HTTP request
	 * @throws Exception if there's a fatal error while we're adding model attributes
	 * @see #exposeHelpers(Map, HttpServletRequest)
	 */
	protected void exposeHelpers(Context velocityContext, HttpServletRequest request) throws Exception {
	}

	/**
	 * Expose the tool attributes, according to corresponding bean property settings.
	 * <p>Do not override this method unless for further tools driven by bean properties.
	 * Override one of the <code>exposeHelpers</code> methods to add custom helpers.
	 * @param velocityContext Velocity context that will be passed to the template
	 * @param request current HTTP request
	 * @throws Exception if there's a fatal error while we're adding model attributes
	 * @see #setVelocityFormatterAttribute
	 * @see #setDateToolAttribute
	 * @see #setNumberToolAttribute
	 * @see #exposeHelpers(Map, HttpServletRequest)
	 * @see #exposeHelpers(org.apache.velocity.context.Context, HttpServletRequest, HttpServletResponse)
	 */
	protected void exposeToolAttributes(Context velocityContext, HttpServletRequest request) throws Exception {
		// Expose generic attributes.
		if (this.toolAttributes != null) {
			for (Iterator it = this.toolAttributes.entrySet().iterator(); it.hasNext();) {
				Map.Entry entry = (Map.Entry) it.next();
				String attributeName = (String) entry.getKey();
				Class toolClass = (Class) entry.getValue();
				try {
					Object tool = toolClass.newInstance();
					initTool(tool, velocityContext);
					velocityContext.put(attributeName, tool);
				}
				catch (Exception ex) {
					throw new NestedServletException("Could not instantiate Velocity tool '" + attributeName + "'", ex);
				}
			}
		}

		// Expose VelocityFormatter attribute.
		if (this.velocityFormatterAttribute != null) {
			velocityContext.put(this.velocityFormatterAttribute, new VelocityFormatter(velocityContext));
		}

		// Expose locale-aware DateTool/NumberTool attributes.
		if (this.dateToolAttribute != null || this.numberToolAttribute != null) {
			Locale locale = RequestContextUtils.getLocale(request);
			if (this.dateToolAttribute != null) {
				velocityContext.put(this.dateToolAttribute, new LocaleAwareDateTool(locale));
			}
			if (this.numberToolAttribute != null) {
				velocityContext.put(this.numberToolAttribute, new LocaleAwareNumberTool(locale));
			}
		}
	}

	/**
	 * Initialize the given tool instance. The default implementation is empty.
	 * <p>Can be overridden to check for special callback interfaces, for example
	 * the ViewContext interface which is part of the view package of Velocity Tools.
	 * In the particular case of ViewContext, you'll usually also need a special
	 * Velocity context, like ChainedContext which is part of Velocity Tools too.
	 * <p>Have a look at {@link VelocityToolboxView}, which pre-implements such a
	 * ViewTool check. This is not part of the standard VelocityView class in order
	 * to avoid a required dependency on the view package of Velocity Tools.
	 * @param tool the tool instance to initialize
	 * @param velocityContext the Velocity context
	 * @throws Exception if initializion of the tool failed
	 * @see #createVelocityContext
	 * @see org.apache.velocity.tools.view.context.ViewContext
	 * @see org.apache.velocity.tools.view.context.ChainedContext
	 * @see VelocityToolboxView
	 */
	protected void initTool(Object tool, Context velocityContext) throws Exception {
	}


	/**
	 * Render the Velocity view to the given response, using the given Velocity
	 * context which contains the complete template model to use.
	 * <p>The default implementation renders the template specified by the "url"
	 * bean property, retrieved via <code>getTemplate</code>. It delegates to the
	 * <code>mergeTemplate</code> method to merge the template instance with the
	 * given Velocity context.
	 * <p>Can be overridden to customize the behavior, for example to render
	 * multiple templates into a single view.
	 * @param context the Velocity context to use for rendering
	 * @param response servlet response (use this to get the OutputStream or Writer)
	 * @throws Exception if thrown by Velocity
	 * @see #setUrl
	 * @see #getTemplate()
	 * @see #mergeTemplate
	 */
	protected void doRender(Context context, HttpServletResponse response) throws Exception {
		if (logger.isDebugEnabled()) {
			logger.debug("Rendering Velocity template [" + getUrl() + "] in VelocityView '" + getBeanName() + "'");
		}
		mergeTemplate(getTemplate(), context, response);
	}

	/**
	 * Retrieve the Velocity template to be rendered by this view.
	 * <p>By default, the template specified by the "url" bean property will be
	 * retrieved: either returning a cached template instance or loading a fresh
	 * instance (according to the "cacheTemplate" bean property)
	 * @return the Velocity template to render
	 * @throws Exception if thrown by Velocity
	 * @see #setUrl
	 * @see #setCacheTemplate
	 * @see #getTemplate(String)
	 */
	protected Template getTemplate() throws Exception {
		// We already hold a reference to the template, but we might want to load it
		// if not caching. Velocity itself caches templates, so our ability to
		// cache templates in this class is a minor optimization only.
		if (isCacheTemplate() && this.template != null) {
			return this.template;
		}
		else {
			return getTemplate(getUrl());
		}
	}

	/**
	 * Retrieve the Velocity template specified by the given name,
	 * using the encoding specified by the "encoding" bean property.
	 * <p>Can be called by subclasses to retrieve a specific template,
	 * for example to render multiple templates into a single view.
	 * @param name the file name of the desired template
	 * @return the Velocity template
	 * @throws Exception if thrown by Velocity
	 * @see org.apache.velocity.app.VelocityEngine#getTemplate
	 */
	protected Template getTemplate(String name) throws Exception {
		return (getEncoding() != null ?
				getVelocityEngine().getTemplate(name, getEncoding()) :
				getVelocityEngine().getTemplate(name));
	}

	/**
	 * Merge the template with the context.
	 * Can be overridden to customize the behavior.
	 * @param template the template to merge
	 * @param context the Velocity context to use for rendering
	 * @param response servlet response (use this to get the OutputStream or Writer)
	 * @throws Exception if thrown by Velocity
	 * @see org.apache.velocity.Template#merge
	 */
	protected void mergeTemplate(
			Template template, Context context, HttpServletResponse response) throws Exception {

		try {
			template.merge(context, response.getWriter());
		}
		catch (MethodInvocationException ex) {
			throw new NestedServletException(
					"Method invocation failed during rendering of Velocity view with name '" +
					getBeanName() + "': " + ex.getMessage() + "; reference [" + ex.getReferenceName() +
					"], method '" + ex.getMethodName() + "'",
					ex.getWrappedThrowable());
		}
	}


	/**
	 * Subclass of DateTool from Velocity Tools, using a passed-in Locale
	 * (usually the RequestContext Locale) instead of the default Locale.N
	 * @see org.springframework.web.servlet.support.RequestContextUtils#getLocale
	 */
	private static class LocaleAwareDateTool extends DateTool {

		private final Locale locale;

		private LocaleAwareDateTool(Locale locale) {
			this.locale = locale;
		}

		public Locale getLocale() {
			return this.locale;
		}
	}


	/**
	 * Subclass of NumberTool from Velocity Tools, using a passed-in Locale
	 * (usually the RequestContext Locale) instead of the default Locale.
	 * @see org.springframework.web.servlet.support.RequestContextUtils#getLocale
	 */
	private static class LocaleAwareNumberTool extends NumberTool {

		private final Locale locale;

		private LocaleAwareNumberTool(Locale locale) {
			this.locale = locale;
		}

		public Locale getLocale() {
			return this.locale;
		}
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
青青草原综合久久大伊人精品优势| 狠狠色狠狠色综合| 日韩经典一区二区| 狠狠色狠狠色综合系列| 99久久777色| 日韩一区国产二区欧美三区| 久久精品无码一区二区三区| 一区二区在线电影| 日韩福利电影在线观看| 成人av影视在线观看| 欧美日韩高清一区二区不卡| 久久综合九色综合欧美98| 一区二区在线观看免费| 精品在线免费视频| av在线一区二区| 日韩欧美aaaaaa| 亚洲蜜桃精久久久久久久| 激情都市一区二区| 欧美无人高清视频在线观看| 欧美精品一区二区三区蜜桃| 亚洲曰韩产成在线| 国产一区二区精品久久91| 欧美日韩日日夜夜| 国产精品乱子久久久久| 男男gaygay亚洲| 91久久免费观看| 国产亚洲一区字幕| 亚洲精品视频一区二区| 国产毛片精品一区| 欧美高清视频不卡网| 中文字幕一区不卡| 国产经典欧美精品| 精品免费国产二区三区| 午夜在线电影亚洲一区| 成人激情免费视频| 欧美日本国产一区| 亚洲欧美日韩国产一区二区三区 | 韩国女主播一区二区三区| 一本色道**综合亚洲精品蜜桃冫| 久久蜜桃一区二区| 亚洲一区免费在线观看| 成人av在线网站| 久久久久97国产精华液好用吗| 日本不卡视频在线| 88在线观看91蜜桃国自产| 亚洲乱码中文字幕| av成人老司机| 亚洲人123区| 日本韩国欧美国产| 亚洲精品国产a| 色欲综合视频天天天| 亚洲欧美区自拍先锋| 99精品视频中文字幕| 自拍av一区二区三区| 国产美女一区二区| 久久午夜羞羞影院免费观看| 韩国中文字幕2020精品| 久久久久久97三级| 国产91精品一区二区| 中文字幕在线观看一区二区| 99久久免费国产| 亚洲日本丝袜连裤袜办公室| 91美女片黄在线观看91美女| 中文一区二区完整视频在线观看| 高清免费成人av| 国产精品久久久久久久午夜片| hitomi一区二区三区精品| 亚洲天堂精品在线观看| 欧美日韩国产小视频在线观看| 三级欧美在线一区| 欧美刺激午夜性久久久久久久| 精品亚洲aⅴ乱码一区二区三区| 久久精品亚洲精品国产欧美kt∨ | 国产精品久久久爽爽爽麻豆色哟哟| 国产成人免费av在线| 亚洲精品一区二区在线观看| 国内外成人在线| 2021中文字幕一区亚洲| 国产精品原创巨作av| 中文字幕av一区 二区| 欧美综合天天夜夜久久| 蜜桃视频一区二区三区在线观看| 久久久久88色偷偷免费| 色久综合一二码| 免费成人在线视频观看| 国产欧美综合色| 在线观看欧美精品| 国内久久精品视频| 亚洲自拍偷拍图区| 精品久久久久99| 成人av网址在线观看| 日日骚欧美日韩| 中文字幕精品—区二区四季| 欧美伊人久久大香线蕉综合69| 美腿丝袜亚洲三区| 一区二区三区中文在线观看| 日韩欧美国产一区二区在线播放| 丁香婷婷综合色啪| 日本美女一区二区三区视频| 国产精品成人一区二区三区夜夜夜| 欧美色老头old∨ideo| 国产成人综合亚洲91猫咪| 亚洲国产成人porn| www国产成人免费观看视频 深夜成人网| 99麻豆久久久国产精品免费| 久草精品在线观看| 国产精品久久久久久久久久免费看 | 欧美一区二区三区免费在线看 | 久久综合久久鬼色| 欧美私人免费视频| 99久久精品情趣| 国产专区欧美精品| 麻豆精品视频在线观看免费| 亚洲精品免费在线观看| 国产午夜精品美女毛片视频| 日韩美一区二区三区| 欧美日韩一区中文字幕| 92国产精品观看| 国产精品一级在线| 日韩av电影一区| 图片区小说区国产精品视频| 亚洲精品免费在线播放| 亚洲欧洲精品一区二区三区| 久久久精品一品道一区| 精品国产区一区| 欧美刺激脚交jootjob| 91蝌蚪porny九色| 成人免费不卡视频| 国产成人在线看| 日韩av一二三| 一区二区三区欧美| 国产精品久久久爽爽爽麻豆色哟哟| 91麻豆精品国产91久久久更新时间| 国产成人av电影| 国产成人av电影在线观看| 国产精品综合二区| 国产精品一区二区黑丝| 国产精品 欧美精品| 国产不卡在线视频| 99久久国产免费看| 色94色欧美sute亚洲线路一ni | 久久九九久精品国产免费直播| 精品动漫一区二区三区在线观看| 欧美大胆人体bbbb| 久久久无码精品亚洲日韩按摩| 精品国产91洋老外米糕| 欧美人牲a欧美精品| 欧美三区在线观看| 欧洲国内综合视频| 制服丝袜成人动漫| 日韩美一区二区三区| 久久这里只有精品6| 欧美激情在线观看视频免费| 亚洲美女免费视频| 亚洲成av人片一区二区梦乃| 日韩国产精品91| 国产v日产∨综合v精品视频| 91蜜桃在线观看| 91精品国产91久久久久久最新毛片 | 成人免费看视频| 91国产成人在线| 欧美精品aⅴ在线视频| 欧美人牲a欧美精品| 欧美精品一区二区三区一线天视频| 久久久久国产精品厨房| 久久久久久9999| 亚洲欧美电影一区二区| 日韩专区一卡二卡| 国产精品一区在线观看乱码| 99国产欧美另类久久久精品 | av色综合久久天堂av综合| 欧洲一区在线电影| 欧美电视剧免费全集观看| 国产精品久久久久久妇女6080| 亚洲成人一二三| 成人av片在线观看| 这里是久久伊人| 国产精品国产精品国产专区不片| 亚洲成a天堂v人片| youjizz久久| 欧美一区二区三区公司| 欧美韩国日本综合| 免费成人在线网站| 一本大道久久a久久综合| 6080日韩午夜伦伦午夜伦| 久久久久9999亚洲精品| 欧美日韩在线播放三区| 国产精品每日更新在线播放网址| 久久精品国产久精国产爱| 欧美高清精品3d| 午夜精品久久久久| 在线观看av一区二区| 亚洲欧美激情在线| 91久久精品一区二区| 亚洲六月丁香色婷婷综合久久 | 欧美日韩国产美| 亚洲电影欧美电影有声小说| 欧美中文字幕久久| 亚洲影视在线观看| 欧美色图片你懂的|