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

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

?? resourcebundleviewresolver.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * 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;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.servlet.View;

/**
 * {@link org.springframework.web.servlet.ViewResolver} implementation 
 * that uses bean definitions in a {@link ResourceBundle}, specified by
 * the bundle basename.
 * 
 * <p>The bundle is typically defined in a properties file, located in
 * the class path. The default bundle basename is "views".
 *
 * <p>This <code>ViewResolver</code> supports localized view definitions,
 * using the default support of {@link java.util.PropertyResourceBundle}.
 * For example, the basename "views" will be resolved as class path resources
 * "views_de_AT.properties", "views_de.properties", "views.properties" -
 * for a given Locale "de_AT".
 *
 * <p>Note: this <code>ViewResolver</code> implements the {@link Ordered}
 * interface to allow for flexible participation in <code>ViewResolver</code>
 * chaining. For example, some special views could be defined via this
 * <code>ViewResolver</code> (giving it 0 as "order" value), while all
 * remaining views could be resolved by a {@link UrlBasedViewResolver}.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 * @see java.util.ResourceBundle#getBundle
 * @see java.util.PropertyResourceBundle
 * @see UrlBasedViewResolver
 */
public class ResourceBundleViewResolver extends AbstractCachingViewResolver implements Ordered, DisposableBean {

	/** The default basename if no other basename is supplied. */
	public final static String DEFAULT_BASENAME = "views";


	private int order = Integer.MAX_VALUE;  // default: same as non-Ordered

	private String[] basenames = new String[] {DEFAULT_BASENAME};

	private ClassLoader bundleClassLoader = Thread.currentThread().getContextClassLoader();

	private String defaultParentView;

	private Locale[] localesToInitialize;

	/* Locale -> BeanFactory */
	private final Map localeCache = new HashMap();

	/* List of ResourceBundle -> BeanFactory */
	private final Map bundleCache = new HashMap();


	public void setOrder(int order) {
		this.order = order;
	}

	public int getOrder() {
		return this.order;
	}

	/**
	 * Set a single basename, following {@link java.util.ResourceBundle} conventions.
	 * The default is "views".
	 * <p><code>ResourceBundle</code> supports different suffixes. For example,
	 * a base name of "views" might map to <code>ResourceBundle</code> files
	 * "views", "views_en_au" and "views_de".
	 * <p>Note that ResourceBundle names are effectively classpath locations: As a
	 * consequence, the JDK's standard ResourceBundle treats dots as package separators.
	 * This means that "test.theme" is effectively equivalent to "test/theme",
	 * just like it is for programmatic <code>java.util.ResourceBundle</code> usage.
	 * @see #setBasenames
	 * @see java.util.ResourceBundle#getBundle(String)
	 */
	public void setBasename(String basename) {
		setBasenames(new String[] {basename});
	}

	/**
	 * Set an array of basenames, each following {@link java.util.ResourceBundle}
	 * conventions. The default is a single basename "views".
	 * <p><code>ResourceBundle</code> supports different suffixes. For example,
	 * a base name of "views" might map to <code>ResourceBundle</code> files
	 * "views", "views_en_au" and "views_de".
	 * <p>The associated resource bundles will be checked sequentially
	 * when resolving a message code. Note that message definitions in a
	 * <i>previous</i> resource bundle will override ones in a later bundle,
	 * due to the sequential lookup.
	 * <p>Note that ResourceBundle names are effectively classpath locations: As a
	 * consequence, the JDK's standard ResourceBundle treats dots as package separators.
	 * This means that "test.theme" is effectively equivalent to "test/theme",
	 * just like it is for programmatic <code>java.util.ResourceBundle</code> usage.
	 * @see #setBasename
	 * @see java.util.ResourceBundle#getBundle(String)
	 */
	public void setBasenames(String[] basenames) {
		this.basenames = basenames;
	}

	/**
	 * Set the {@link ClassLoader} to load resource bundles with.
	 * Default is the thread context <code>ClassLoader</code>.
	 */
	public void setBundleClassLoader(ClassLoader classLoader) {
		this.bundleClassLoader = classLoader;
	}

	/**
	 * Return the {@link ClassLoader} to load resource bundles with.
	 * <p>Default is the specified bundle <code>ClassLoader</code>,
	 * usually the thread context <code>ClassLoader</code>.
	 */
	protected ClassLoader getBundleClassLoader() {
		return this.bundleClassLoader;
	}

	/**
	 * Set the default parent for views defined in the <code>ResourceBundle</code>.
	 * <p>This avoids repeated "yyy1.(parent)=xxx", "yyy2.(parent)=xxx" definitions
	 * in the bundle, especially if all defined views share the same parent.
	 * <p>The parent will typically define the view class and common attributes.
	 * Concrete views might simply consist of an URL definition then:
	 * a la "yyy1.url=/my.jsp", "yyy2.url=/your.jsp".
	 * <p>View definitions that define their own parent or carry their own
	 * class can still override this. Strictly speaking, the rule that a
	 * default parent setting does not apply to a bean definition that
	 * carries a class is there for backwards compatiblity reasons.
	 * It still matches the typical use case.
	 */
	public void setDefaultParentView(String defaultParentView) {
		this.defaultParentView = defaultParentView;
	}

	/**
	 * Specify Locales to initialize eagerly, rather than lazily when actually accessed.
	 * <p>Allows for pre-initialization of common Locales, eagerly checking
	 * the view configuration for those Locales.
	 */
	public void setLocalesToInitialize(Locale[] localesToInitialize) {
		this.localesToInitialize = localesToInitialize;
	}


	protected void initApplicationContext() throws BeansException {
		if (this.localesToInitialize != null) {
			for (int i = 0; i < this.localesToInitialize.length; i++) {
				initFactory(this.localesToInitialize[i]);
			}
		}
	}

	protected View loadView(String viewName, Locale locale) throws Exception {
		BeanFactory factory = initFactory(locale);
		try {
			return (View) factory.getBean(viewName, View.class);
		}
		catch (NoSuchBeanDefinitionException ex) {
			// to allow for ViewResolver chaining
			return null;
		}
	}

	/**
	 * Initialize the View {@link BeanFactory} from the <code>ResourceBundle</code>,
	 * for the given {@link Locale locale}.
	 * <p>Synchronized because of access by parallel threads.
	 * @param locale the target <code>Locale</code>
	 * @return the View factory for the given Locale
	 * @throws BeansException in case of initialization errors
	 */
	protected synchronized BeanFactory initFactory(Locale locale) throws BeansException {
		// Try to find cached factory for Locale:
		// Have we already encountered that Locale before?
		if (isCache()) {
			BeanFactory cachedFactory = (BeanFactory) this.localeCache.get(locale);
			if (cachedFactory != null) {
				return cachedFactory;
			}
		}

		// Build list of ResourceBundle references for Locale.
		List bundles = new LinkedList();
		for (int i = 0; i < this.basenames.length; i++) {
			ResourceBundle bundle = getBundle(this.basenames[i], locale);
			bundles.add(bundle);
		}

		// Try to find cached factory for ResourceBundle list:
		// even if Locale was different, same bundles might have been found.
		if (isCache()) {
			BeanFactory cachedFactory = (BeanFactory) this.bundleCache.get(bundles);
			if (cachedFactory != null) {
				this.localeCache.put(locale, cachedFactory);
				return cachedFactory;
			}
		}

		// Create child ApplicationContext for views.
		GenericWebApplicationContext factory = new GenericWebApplicationContext();
		factory.setParent(getApplicationContext());
		factory.setServletContext(getServletContext());

		// Load bean definitions from resource bundle.
		PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(factory);
		reader.setDefaultParentBean(this.defaultParentView);
		for (int i = 0; i < bundles.size(); i++) {
			ResourceBundle bundle = (ResourceBundle) bundles.get(i);
			reader.registerBeanDefinitions(bundle);
		}

		factory.refresh();

		// Cache factory for both Locale and ResourceBundle list.
		if (isCache()) {
			this.localeCache.put(locale, factory);
			this.bundleCache.put(bundles, factory);
		}

		return factory;
	}

	/**
	 * Obtain the resource bundle for the given basename and {@link Locale}.
	 * @param basename the basename to look for
	 * @param locale the <code>Locale</code> to look for
	 * @return the corresponding <code>ResourceBundle</code>
	 * @throws MissingResourceException if no matching bundle could be found
	 * @see java.util.ResourceBundle#getBundle(String, java.util.Locale, ClassLoader)
	 */
	protected ResourceBundle getBundle(String basename, Locale locale) throws MissingResourceException {
		return ResourceBundle.getBundle(basename, locale, getBundleClassLoader());
	}


	/**
	 * Close the bundle View factories on context shutdown.
	 */
	public void destroy() throws BeansException {
		for (Iterator it = this.bundleCache.values().iterator(); it.hasNext();) {
			ConfigurableApplicationContext factory = (ConfigurableApplicationContext) it.next();
			factory.close();
		}
		this.localeCache.clear();
		this.bundleCache.clear();
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91社区在线播放| 婷婷综合五月天| 亚洲色图都市小说| 亚洲午夜激情网页| 久久疯狂做爰流白浆xx| 懂色av一区二区三区免费观看 | 精品国产乱码久久久久久闺蜜| 精品电影一区二区| 日韩美女视频19| 日韩精品色哟哟| 丰满少妇在线播放bd日韩电影| 色婷婷综合激情| 日韩免费性生活视频播放| 欧美国产精品中文字幕| 视频一区二区三区入口| 成人美女视频在线观看| 欧美高清www午色夜在线视频| 国产视频视频一区| 亚洲成va人在线观看| 国产乱妇无码大片在线观看| 欧美视频在线一区二区三区 | 国产一区二区h| 色综合久久99| 精品国产一区久久| 亚洲国产欧美日韩另类综合 | 日韩一区在线播放| 久久精品久久精品| 日本道精品一区二区三区| 精品国产3级a| 亚洲一区二区在线免费观看视频| 久久99精品一区二区三区三区| 色婷婷av一区二区三区之一色屋| 久久久高清一区二区三区| 一区二区三区在线视频播放| 粉嫩久久99精品久久久久久夜 | 韩国欧美一区二区| 欧美日韩精品一区二区在线播放| 欧美激情一区在线观看| 日韩和欧美一区二区| 99九九99九九九视频精品| 欧美mv日韩mv国产网站| 香蕉久久一区二区不卡无毒影院| www.日韩在线| 久久人人爽爽爽人久久久| 日韩精品一二三区| 欧美在线不卡一区| 国产精品久久三区| 国产精品影视网| 精品国产第一区二区三区观看体验| 亚洲一区二区高清| 色狠狠色狠狠综合| 亚洲三级久久久| 从欧美一区二区三区| 久久综合九色综合97_久久久| 日韩成人伦理电影在线观看| 欧美日韩综合不卡| 一区二区三区在线视频观看| heyzo一本久久综合| 中文字幕精品一区二区精品绿巨人 | 成人教育av在线| 国产亚洲精品bt天堂精选| 麻豆精品视频在线观看免费 | 精品一区二区三区在线播放| 欧美电影在线免费观看| 五月婷婷综合在线| 欧美日韩在线一区二区| 亚洲成人免费av| 欧美日韩五月天| 亚洲mv大片欧洲mv大片精品| 欧美日韩国产123区| 亚洲成人黄色影院| 欧美日韩国产免费一区二区| 亚洲成av人**亚洲成av**| 欧洲av一区二区嗯嗯嗯啊| 亚洲一区二区三区在线| 91国产视频在线观看| 亚洲夂夂婷婷色拍ww47| 欧美亚洲一区二区在线观看| 亚洲午夜电影在线观看| 欧美久久久久久蜜桃| 日韩av一区二区在线影视| 日韩欧美在线1卡| 国产一区二区三区综合| 国产亚洲成av人在线观看导航| 高清在线观看日韩| 亚洲色图欧美激情| 在线亚洲一区二区| 亚洲一卡二卡三卡四卡| 欧美日产国产精品| 久久99精品久久久久久动态图| 久久久久久久久久久久久女国产乱| 国产黄色成人av| 中文字幕中文字幕中文字幕亚洲无线| 91农村精品一区二区在线| 亚洲女同一区二区| 欧美日韩一区二区三区在线| 琪琪一区二区三区| 久久精子c满五个校花| av日韩在线网站| 一区二区三区免费在线观看| 555www色欧美视频| 国产精品主播直播| 一区二区三区日本| 日韩一区二区免费视频| 国产精品影音先锋| 亚洲精品欧美二区三区中文字幕| 制服丝袜一区二区三区| 粉嫩一区二区三区在线看| 一区二区三区四区av| 欧美成人三级在线| yourporn久久国产精品| 三级一区在线视频先锋| 久久亚洲精品国产精品紫薇| 色综合天天性综合| 热久久国产精品| 国产精品免费视频观看| 欧美日韩精品欧美日韩精品一综合| 捆绑紧缚一区二区三区视频| 中文字幕一区视频| 欧美一级片在线| 波多野结衣一区二区三区| 亚洲成人av福利| 国产精品三级电影| 欧美丰满嫩嫩电影| 波多野结衣视频一区| 美腿丝袜亚洲综合| 亚洲人精品午夜| 久久综合久久综合九色| 日本精品一级二级| 精品一区二区免费看| 尤物在线观看一区| 国产肉丝袜一区二区| 欧美日韩精品欧美日韩精品一 | 国产精品不卡视频| 日韩欧美国产系列| 色婷婷久久久综合中文字幕| 国产一区二区三区最好精华液| 亚洲一区二区视频在线| 亚洲国产精品精华液2区45| 欧美理论电影在线| a4yy欧美一区二区三区| 国产综合色在线视频区| 亚洲无人区一区| 国产精品不卡一区二区三区| 欧美v亚洲v综合ⅴ国产v| 欧美图区在线视频| 99国产欧美另类久久久精品| 国产精品中文有码| 免费在线观看一区二区三区| 亚洲国产美女搞黄色| 中文字幕一区二区三区在线观看 | 国产白丝网站精品污在线入口| 日韩精品一二三| 亚洲国产精品久久人人爱| 中文字幕av免费专区久久| 26uuu久久综合| 欧美一区二区三区视频免费| 欧美三级视频在线| 色老汉av一区二区三区| 99精品偷自拍| 成人app软件下载大全免费| 狠狠网亚洲精品| 另类小说视频一区二区| 日韩精彩视频在线观看| 亚洲电影一区二区| 玉足女爽爽91| 亚洲男人的天堂在线观看| 国产精品久久久99| 国产精品久久一级| 国产精品素人视频| 日本一区二区三区四区在线视频| 久久综合久久鬼色中文字| 精品久久久影院| 日韩一级完整毛片| 日韩欧美一区二区在线视频| 欧美老女人第四色| 欧美日韩精品电影| 欧美男人的天堂一二区| 欧美精品一卡两卡| 欧美一级理论性理论a| 欧美一级生活片| 日韩一级大片在线观看| 日韩午夜av电影| 精品日韩在线观看| 久久久久99精品一区| 国产午夜久久久久| 欧美韩日一区二区三区四区| 国产精品色一区二区三区| 中日韩av电影| 亚洲久本草在线中文字幕| 一区二区三区精密机械公司| 亚洲综合色成人| 首页国产欧美久久| 日韩国产高清在线| 紧缚捆绑精品一区二区| 国产激情视频一区二区在线观看| 夫妻av一区二区| 一本到高清视频免费精品| 欧美视频自拍偷拍| 欧美大片日本大片免费观看|