org.springframework.context.i18n.TimeZoneAwareLocaleContext#org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext源码实例Demo

下面列出了org.springframework.context.i18n.TimeZoneAwareLocaleContext#org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spring-analysis-note   文件: RequestContext.java
/**
 * Change the current locale to the specified locale and time zone context,
 * storing the new locale context through the configured {@link LocaleResolver}.
 * @param locale the new locale
 * @param timeZone the new time zone
 * @see LocaleContextResolver#setLocaleContext
 * @see org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext
 */
public void changeLocale(Locale locale, TimeZone timeZone) {
	LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(this.request);
	if (!(localeResolver instanceof LocaleContextResolver)) {
		throw new IllegalStateException("Cannot change locale context if no LocaleContextResolver configured");
	}
	((LocaleContextResolver) localeResolver).setLocaleContext(this.request, this.response,
			new SimpleTimeZoneAwareLocaleContext(locale, timeZone));
	this.locale = locale;
	this.timeZone = timeZone;
}
 
源代码2 项目: java-technology-stack   文件: RequestContext.java
/**
 * Change the current locale to the specified locale and time zone context,
 * storing the new locale context through the configured {@link LocaleResolver}.
 * @param locale the new locale
 * @param timeZone the new time zone
 * @see LocaleContextResolver#setLocaleContext
 * @see org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext
 */
public void changeLocale(Locale locale, TimeZone timeZone) {
	LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(this.request);
	if (!(localeResolver instanceof LocaleContextResolver)) {
		throw new IllegalStateException("Cannot change locale context if no LocaleContextResolver configured");
	}
	((LocaleContextResolver) localeResolver).setLocaleContext(this.request, this.response,
			new SimpleTimeZoneAwareLocaleContext(locale, timeZone));
	this.locale = locale;
	this.timeZone = timeZone;
}
 
源代码3 项目: lams   文件: RequestContext.java
/**
 * Change the current locale to the specified locale and time zone context,
 * storing the new locale context through the configured {@link LocaleResolver}.
 * @param locale the new locale
 * @param timeZone the new time zone
 * @see LocaleContextResolver#setLocaleContext
 * @see org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext
 */
public void changeLocale(Locale locale, TimeZone timeZone) {
	LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(this.request);
	if (!(localeResolver instanceof LocaleContextResolver)) {
		throw new IllegalStateException("Cannot change locale context if no LocaleContextResolver configured");
	}
	((LocaleContextResolver) localeResolver).setLocaleContext(this.request, this.response,
			new SimpleTimeZoneAwareLocaleContext(locale, timeZone));
	this.locale = locale;
	this.timeZone = timeZone;
}
 
源代码4 项目: spring4-understanding   文件: RequestContext.java
/**
 * Change the current locale to the specified locale and time zone context,
 * storing the new locale context through the configured {@link LocaleResolver}.
 * @param locale the new locale
 * @param timeZone the new time zone
 * @see LocaleContextResolver#setLocaleContext
 * @see org.springframework.context.i18n.SimpleTimeZoneAwareLocaleContext
 */
public void changeLocale(Locale locale, TimeZone timeZone) {
	LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(this.request);
	if (!(localeResolver instanceof LocaleContextResolver)) {
		throw new IllegalStateException("Cannot change locale context if no LocaleContextResolver configured");
	}
	((LocaleContextResolver) localeResolver).setLocaleContext(this.request, this.response,
			new SimpleTimeZoneAwareLocaleContext(locale, timeZone));
	this.locale = locale;
	this.timeZone = timeZone;
}