Spring Framework SimpleLocaleContext - 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 SimpleLocaleContext class.

This code example shows how to use the following methods:
		return resolveLocaleContext(request).getLocale(); 
	} 
 
	@Override 
	public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) { 
		setLocaleContext(request, response, (locale != null ? new SimpleLocaleContext(locale) : null)); 
	} 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	public static void setLocaleContext(LocaleContext localeContext) {
		localeContextHolder.set(localeContext);
	} 
	@SuppressWarnings("unchecked") 
	public static void setLocale(Locale locale) {
		LocaleContext localeContext = (locale != null ? new SimpleLocaleContext(locale) : null);
		localeContextHolder.set(localeContext);
		 
	} 
	public static Locale getLocale() {
		LocaleContext localeContext = (LocaleContext) localeContextHolder.get();
		return (localeContext != null ? localeContext.getLocale() : Global.getDefaultLocale());
	} 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	 * primary locale as current locale. 
	 * @param request current HTTP request 
	 * @return the corresponding LocaleContext 
	 */ 
	protected LocaleContext buildLocaleContext(PortletRequest request) {
		return new SimpleLocaleContext(request.getLocale());
	} 
 
	/** 
	 * Determine the username for the given request. 
	 * <p>The default implementation first tries the UserPrincipal. 
	 * If that does not exist, then it checks the USER_INFO map. 
	 * Can be overridden in subclasses. 
	 * @param request current portlet request 
	 * @return the username, or {@code null} if none found 
	 * @see javax.portlet.PortletRequest#getUserPrincipal() 
	 * @see javax.portlet.PortletRequest#getRemoteUser() 
	 * @see javax.portlet.PortletRequest#USER_INFO 
	 * @see #setUserinfoUsernameAttributes 
	 */ 
3
CodeRank
Experience pair programming with AI  Get Codota for Java