Class LocaleContextInfoUtils
java.lang.Object
org.exoplatform.portal.localization.LocaleContextInfoUtils
This class is used to ease
LocaleContextInfo object build-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LocaleContextInfobuildLocaleContextInfo(jakarta.servlet.http.HttpServletRequest request) Helper method for setters invocation onLocaleContextInfoobjectstatic LocaleContextInfobuildLocaleContextInfo(String userId) Helper method for setters invocation onLocaleContextInfoobjectstatic LocalecomputeLocale(jakarta.servlet.http.HttpServletRequest request) Computes locale of currently authenticated user based on multiple conditions switch implementedLocalePolicy: - User Profile Locale (coming from User preferences) - Session Locale - Browser Locale - Cookie LocalegetCookieLocales(jakarta.servlet.http.HttpServletRequest request) Helper method to retrieve supportedLocales from LocaleConfigService
-
Constructor Details
-
LocaleContextInfoUtils
public LocaleContextInfoUtils()
-
-
Method Details
-
computeLocale
Computes locale of currently authenticated user based on multiple conditions switch implementedLocalePolicy: - User Profile Locale (coming from User preferences) - Session Locale - Browser Locale - Cookie Locale- Parameters:
request-HttpServletRequestWrapper- Returns:
Localeretrieved usingLocalePolicy, else return default configured locale inLocaleConfigService
-
buildLocaleContextInfo
public static LocaleContextInfo buildLocaleContextInfo(jakarta.servlet.http.HttpServletRequest request) Helper method for setters invocation onLocaleContextInfoobject- Parameters:
request-- Returns:
- a built
LocaleContextInfoobject
-
buildLocaleContextInfo
Helper method for setters invocation onLocaleContextInfoobject- Parameters:
userId-- Returns:
- a built
LocaleContextInfoobject
-
getCookieLocales
- Parameters:
request-- Returns:
-
getSupportedLocales
Helper method to retrieve supportedLocales from LocaleConfigService- Returns:
- supportedLocales
-