Java Code Examples for org.springframework.context.i18n.LocaleContextHolder#setLocaleContext()

The following examples show how to use org.springframework.context.i18n.LocaleContextHolder#setLocaleContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FrameworkServlet.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private void initContextHolders(HttpServletRequest request,
		@Nullable LocaleContext localeContext, @Nullable RequestAttributes requestAttributes) {

	if (localeContext != null) {
		LocaleContextHolder.setLocaleContext(localeContext, this.threadContextInheritable);
	}
	if (requestAttributes != null) {
		RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable);
	}
}
 
Example 2
Source File: FrameworkServlet.java    From java-technology-stack with MIT License 5 votes vote down vote up
private void initContextHolders(HttpServletRequest request,
		@Nullable LocaleContext localeContext, @Nullable RequestAttributes requestAttributes) {

	if (localeContext != null) {
		LocaleContextHolder.setLocaleContext(localeContext, this.threadContextInheritable);
	}
	if (requestAttributes != null) {
		RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable);
	}
}
 
Example 3
Source File: FrameworkServlet.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void initContextHolders(
		HttpServletRequest request, LocaleContext localeContext, RequestAttributes requestAttributes) {

	if (localeContext != null) {
		LocaleContextHolder.setLocaleContext(localeContext, this.threadContextInheritable);
	}
	if (requestAttributes != null) {
		RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable);
	}
	if (logger.isTraceEnabled()) {
		logger.trace("Bound request context to thread: " + request);
	}
}
 
Example 4
Source File: FrameworkServlet.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void resetContextHolders(HttpServletRequest request,
		LocaleContext prevLocaleContext, RequestAttributes previousAttributes) {

	LocaleContextHolder.setLocaleContext(prevLocaleContext, this.threadContextInheritable);
	RequestContextHolder.setRequestAttributes(previousAttributes, this.threadContextInheritable);
	if (logger.isTraceEnabled()) {
		logger.trace("Cleared thread-bound request context: " + request);
	}
}
 
Example 5
Source File: FrameworkServlet.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private void initContextHolders(
		HttpServletRequest request, LocaleContext localeContext, RequestAttributes requestAttributes) {

	if (localeContext != null) {
		LocaleContextHolder.setLocaleContext(localeContext, this.threadContextInheritable);
	}
	if (requestAttributes != null) {
		RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable);
	}
	if (logger.isTraceEnabled()) {
		logger.trace("Bound request context to thread: " + request);
	}
}
 
Example 6
Source File: FrameworkServlet.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private void resetContextHolders(HttpServletRequest request,
		LocaleContext prevLocaleContext, RequestAttributes previousAttributes) {

	LocaleContextHolder.setLocaleContext(prevLocaleContext, this.threadContextInheritable);
	RequestContextHolder.setRequestAttributes(previousAttributes, this.threadContextInheritable);
	if (logger.isTraceEnabled()) {
		logger.trace("Cleared thread-bound request context: " + request);
	}
}
 
Example 7
Source File: FrameworkServlet.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private void resetContextHolders(HttpServletRequest request,
		@Nullable LocaleContext prevLocaleContext, @Nullable RequestAttributes previousAttributes) {

	LocaleContextHolder.setLocaleContext(prevLocaleContext, this.threadContextInheritable);
	RequestContextHolder.setRequestAttributes(previousAttributes, this.threadContextInheritable);
}
 
Example 8
Source File: FrameworkServlet.java    From java-technology-stack with MIT License 4 votes vote down vote up
private void resetContextHolders(HttpServletRequest request,
		@Nullable LocaleContext prevLocaleContext, @Nullable RequestAttributes previousAttributes) {

	LocaleContextHolder.setLocaleContext(prevLocaleContext, this.threadContextInheritable);
	RequestContextHolder.setRequestAttributes(previousAttributes, this.threadContextInheritable);
}