Spring Framework LocaleResolver - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework LocaleResolver class.

This code example shows how to use the following methods:resolveLocale
	 * @see #getLocaleResolver 
	 * @see org.springframework.context.i18n.LocaleContextHolder#getLocale() 
	 */ 
	public static Locale getLocale(HttpServletRequest request) { 
		LocaleResolver localeResolver = getLocaleResolver(request); 
		return (localeResolver != null ? localeResolver.resolveLocale(request) : request.getLocale()); 
	} 
 
	/** 
	 * Retrieve the current time zone from the given request, using the 
	 * TimeZoneAwareLocaleResolver bound to the request by the DispatcherServlet 
	 * (if available), falling back to the system's default time zone. 
	 * <p>Note: This method returns {@code null} if no specific time zone can be 
	 * resolved for the given request. This is in contrast to {@link #getLocale} 
	 * where there is always the request's accept-header locale to fall back to. 
	 * <p>Consider using {@link org.springframework.context.i18n.LocaleContextHolder#getTimeZone()} 
	 * which will normally be populated with the same TimeZone: That method only 
	 * differs in terms of its fallback to the system time zone if the LocaleResolver 
	 * hasn't provided provided a specific time zone (instead of this method's {@code null}). 
	 * @param request current HTTP request 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Spring Framework LocaleResolver Methods: