Class AcceptLanguageLocaleHandler
java.lang.Object
org.apache.struts2.interceptor.i18n.AbstractLocaleHandler
org.apache.struts2.interceptor.i18n.RequestLocaleHandler
org.apache.struts2.interceptor.i18n.AcceptLanguageLocaleHandler
- All Implemented Interfaces:
LocaleHandler
- Direct Known Subclasses:
AbstractStoredLocaleHandler
Resolves locale by first checking the request-only parameter and then falling back
to the browser's
Accept-Language header.
When a supportedLocale set is configured, only Accept-Language values present
in that set are accepted. When the set is empty (the default), the first locale
advertised by the browser is returned as-is.
-
Field Summary
Fields inherited from class org.apache.struts2.interceptor.i18n.AbstractLocaleHandler
actionInvocation -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAcceptLanguageLocaleHandler(ActionInvocation invocation, String requestOnlyParameterName, Set<Locale> supportedLocale) -
Method Summary
Modifier and TypeMethodDescriptionfind()Looks for an explicit locale override in request-scoped sources.protected Localeread(ActionInvocation invocation) Reads locale from persistent/context sources whenLocaleHandler.find()did not resolve one.Methods inherited from class org.apache.struts2.interceptor.i18n.RequestLocaleHandler
findRequestOnlyParamLocale, storeMethods inherited from class org.apache.struts2.interceptor.i18n.AbstractLocaleHandler
disableStore, findLocaleParameter, getLocaleFromParam, isLocaleSupported, shouldStore
-
Constructor Details
-
AcceptLanguageLocaleHandler
protected AcceptLanguageLocaleHandler(ActionInvocation invocation, String requestOnlyParameterName, Set<Locale> supportedLocale)
-
-
Method Details
-
find
Description copied from interface:LocaleHandlerLooks for an explicit locale override in request-scoped sources.- Specified by:
findin interfaceLocaleHandler- Overrides:
findin classRequestLocaleHandler- Returns:
- a locale override or
nullwhen no explicit override is present
-
read
Description copied from interface:LocaleHandlerReads locale from persistent/context sources whenLocaleHandler.find()did not resolve one.- Specified by:
readin interfaceLocaleHandler- Overrides:
readin classRequestLocaleHandler- Parameters:
invocation- current action invocation- Returns:
- resolved locale or
nullwhen no locale could be resolved
-
findAcceptLanguageLocale
-