Interface LocaleHandler
- All Known Subinterfaces:
I18nInterceptor.LocaleHandler
- All Known Implementing Classes:
AbstractLocaleHandler,AbstractStoredLocaleHandler,AcceptLanguageLocaleHandler,CookieLocaleHandler,I18nInterceptor.AcceptLanguageLocaleHandler,I18nInterceptor.CookieLocaleHandler,I18nInterceptor.LocaleHandlerAdapter,I18nInterceptor.RequestLocaleHandler,I18nInterceptor.SessionLocaleHandler,RequestLocaleHandler,SessionLocaleHandler
public interface LocaleHandler
Strategy used by
I18nInterceptor to resolve and optionally persist the current request locale.
Implementations encapsulate locale source-specific behavior (request parameters, session, cookies, or Accept-Language header), while the interceptor orchestrates the overall lifecycle.
-
Method Summary
Modifier and TypeMethodDescriptionfind()Looks for an explicit locale override in request-scoped sources.read(ActionInvocation invocation) Reads locale from persistent/context sources whenfind()did not resolve one.booleanIndicates if the locale should be persisted for the current request.store(ActionInvocation invocation, Locale locale) Persists the resolved locale when storage is enabled for the current handler.
-
Method Details
-
find
Locale find()Looks for an explicit locale override in request-scoped sources.- Returns:
- a locale override or
nullwhen no explicit override is present
-
read
Reads locale from persistent/context sources whenfind()did not resolve one.- Parameters:
invocation- current action invocation- Returns:
- resolved locale or
nullwhen no locale could be resolved
-
store
Persists the resolved locale when storage is enabled for the current handler.- Parameters:
invocation- current action invocationlocale- locale to store- Returns:
- the effective locale to apply to the invocation context
-
shouldStore
boolean shouldStore()Indicates if the locale should be persisted for the current request.- Returns:
truewhenstore(ActionInvocation, Locale)should be invoked
-