public class DefaultLocaleResolver extends Object implements LocaleResolver, RequestLocaleResolver
DefaultLocaleResolver
resolves the request's Locale by
calling the ServletRequest.getLocales()
method, which generally
will be the Servlet Container's implementation of this method and thus be
based on the client's Accept-Language
header.Constructor and Description |
---|
DefaultLocaleResolver() |
Modifier and Type | Method and Description |
---|---|
List<Locale> |
resolveLocale(javax.servlet.http.HttpServletRequest request)
Return a non-
null but possibly empty list of
Locale instances to consider for localization of the current
request. |
List<Locale> |
resolveLocale(SlingHttpServletRequest request)
Return the Locales provided by the
ServletRequest.getLocales() method collected in a
List . |
public List<Locale> resolveLocale(SlingHttpServletRequest request)
ServletRequest.getLocales()
method collected in a
List
.resolveLocale
in interface LocaleResolver
request
- The SlingHttpServletRequest
providing hints
and information for the Locale
resolution.Locale
s to use for internationalization
of request processingpublic List<Locale> resolveLocale(javax.servlet.http.HttpServletRequest request)
RequestLocaleResolver
null
but possibly empty list of
Locale
instances to consider for localization of the current
request. The list returned is assumed to be ordered by preference where
the first entry is the preferred Locale
and the last entry is
the least preferred Locale
.
Returning an empty list is equivalent to returning a singleton list whose
single entry is the ResourceBundleProvider.getDefaultLocale()
.
resolveLocale
in interface RequestLocaleResolver
request
- The HttpServletRequest
providing hints
and information for the Locale
resolution.Locale
s to use for internationalization
of request processingRequestLocaleResolver.resolveLocale(javax.servlet.http.HttpServletRequest)
Copyright © 2017 The Apache Software Foundation. All rights reserved.