Package org.apache.sling.i18n
Class DefaultLocaleResolver
- java.lang.Object
-
- org.apache.sling.i18n.DefaultLocaleResolver
-
- All Implemented Interfaces:
LocaleResolver,RequestLocaleResolver
public class DefaultLocaleResolver extends java.lang.Object implements LocaleResolver, RequestLocaleResolver
TheDefaultLocaleResolverresolves the request's Locale by calling theServletRequest.getLocales()method, which generally will be the Servlet Container's implementation of this method and thus be based on the client'sAccept-Languageheader.
-
-
Constructor Summary
Constructors Constructor Description DefaultLocaleResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.util.Locale>resolveLocale(javax.servlet.http.HttpServletRequest request)Return a non-nullbut possibly empty list ofLocaleinstances to consider for localization of the current request.java.util.List<java.util.Locale>resolveLocale(SlingHttpServletRequest request)Return the Locales provided by theServletRequest.getLocales()method collected in aList.
-
-
-
Method Detail
-
resolveLocale
public java.util.List<java.util.Locale> resolveLocale(SlingHttpServletRequest request)
Return the Locales provided by theServletRequest.getLocales()method collected in aList.- Specified by:
resolveLocalein interfaceLocaleResolver- Parameters:
request- TheSlingHttpServletRequestproviding hints and information for theLocaleresolution.- Returns:
- The list of
Locales to use for internationalization of request processing
-
resolveLocale
public java.util.List<java.util.Locale> resolveLocale(javax.servlet.http.HttpServletRequest request)
Description copied from interface:RequestLocaleResolverReturn a non-nullbut possibly empty list ofLocaleinstances to consider for localization of the current request. The list returned is assumed to be ordered by preference where the first entry is the preferredLocaleand the last entry is the least preferredLocale.Returning an empty list is equivalent to returning a singleton list whose single entry is the
ResourceBundleProvider.getDefaultLocale().- Specified by:
resolveLocalein interfaceRequestLocaleResolver- Parameters:
request- TheHttpServletRequestproviding hints and information for theLocaleresolution.- Returns:
- The list of
Locales to use for internationalization of request processing - See Also:
RequestLocaleResolver.resolveLocale(javax.servlet.http.HttpServletRequest)
-
-