当前位置: 首页>>代码示例>>Java>>正文


Java ResourceBundleMessageSource.setParentMessageSource方法代码示例

本文整理汇总了Java中org.springframework.context.support.ResourceBundleMessageSource.setParentMessageSource方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceBundleMessageSource.setParentMessageSource方法的具体用法?Java ResourceBundleMessageSource.setParentMessageSource怎么用?Java ResourceBundleMessageSource.setParentMessageSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.context.support.ResourceBundleMessageSource的用法示例。


在下文中一共展示了ResourceBundleMessageSource.setParentMessageSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJstlAwareMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //导入方法依赖的package包/类
/**
 * Checks JSTL's "javax.servlet.jsp.jstl.fmt.localizationContext"
 * context-param and creates a corresponding child message source,
 * with the provided Spring-defined MessageSource as parent.
 * @param servletContext the ServletContext we're running in
 * (to check JSTL-related context-params in {@code web.xml})
 * @param messageSource the MessageSource to expose, typically
 * the ApplicationContext of the current DispatcherServlet
 * @return the MessageSource to expose to JSTL; first checking the
 * JSTL-defined bundle, then the Spring-defined MessageSource
 * @see org.springframework.context.ApplicationContext
 */
public static MessageSource getJstlAwareMessageSource(
		ServletContext servletContext, MessageSource messageSource) {

	if (servletContext != null) {
		String jstlInitParam = servletContext.getInitParameter(Config.FMT_LOCALIZATION_CONTEXT);
		if (jstlInitParam != null) {
			// Create a ResourceBundleMessageSource for the specified resource bundle
			// basename in the JSTL context-param in web.xml, wiring it with the given
			// Spring-defined MessageSource as parent.
			ResourceBundleMessageSource jstlBundleWrapper = new ResourceBundleMessageSource();
			jstlBundleWrapper.setBasename(jstlInitParam);
			jstlBundleWrapper.setParentMessageSource(messageSource);
			return jstlBundleWrapper;
		}
	}
	return messageSource;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:JstlUtils.java

示例2: createMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //导入方法依赖的package包/类
@Override
protected MessageSource createMessageSource(String basename) {
    ResourceBundleMessageSource messageSource = (ResourceBundleMessageSource) super.createMessageSource(basename);

    // Create parent theme recursively.
    for (Theme theme : settingsService.getAvailableThemes()) {
        if (basename.equals(basenamePrefix + theme.getId()) && theme.getParent() != null) {
            String parent = basenamePrefix + theme.getParent();
            messageSource.setParentMessageSource(createMessageSource(parent));
            break;
        }
    }
    return messageSource;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:15,代码来源:CustomThemeSource.java

示例3: createMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //导入方法依赖的package包/类
@Override
protected MessageSource createMessageSource(String basename) {
    ResourceBundleMessageSource messageSource = (ResourceBundleMessageSource) super.createMessageSource(basename);

    ResourceBundleMessageSource parentMessageSource = new ResourceBundleMessageSource();
    parentMessageSource.setBasename(defaultResourceBundle);
    messageSource.setParentMessageSource(parentMessageSource);

    return messageSource;
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:11,代码来源:SubsonicThemeSource.java


注:本文中的org.springframework.context.support.ResourceBundleMessageSource.setParentMessageSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。