public class I18nHandlerForServletRequest extends I18nHandlerInContext<ServletRequest>
This I18nHandlerInContext
subclass is ready-to-use to implement
the approach with user locale preferences being retrieved from
ServletRequest
Accept-Language
headers.
You may optionally wish to further subclass this class to override the
I18nHandler.getDefaultLocaleTag()
method. You may also wish to subclass this
class for retrieving locale preferences for authenticated users via some
HttpSession
attribute.
Constructor and Description |
---|
I18nHandlerForServletRequest() |
Modifier and Type | Method and Description |
---|---|
protected String[] |
getUserLocaleTags(ServletRequest contextData)
An implementation of the method to get an array of user preferred
locales from a
ServletRequest
instance via Accept-Language headers. |
findBestLocaleTag
findBestLocaleTag, findBestLocaleTag, getDefaultLocaleTag, getUserLocaleTags, localeForLanguageTag
protected String[] getUserLocaleTags(ServletRequest contextData)
ServletRequest
instance via Accept-Language
headers.getUserLocaleTags
in class I18nHandlerInContext<ServletRequest>
contextData
- a ServletRequest
instance to retrieve user preferences fromlocale language tags
as specified by the ServletRequest
, falling back to the
application default locale if empty