public interface PortletLocaleResolver
This interface allows for implementations based on request, session, cookies, etc. The default implementation is
AcceptHeaderLocaleResolver
, simply using the request's locale provided
by the respective HTTP header.
Use RequestContext.getLocale()
to retrieve the current locale in
controllers or views, independent of the actual resolution strategy.
Note: As of Spring 4.0, there is an extended strategy interface called LocaleContextResolver
, allowing for
resolution of a LocaleContext
object, potentially including associated time
zone information. Spring's provided resolver implementations implement the extended LocaleContextResolver
interface wherever appropriate.
LocaleContextResolver
,
LocaleContextHolder
,
RequestContext.getLocale()
,
RequestContextUtils.getLocale(javax.servlet.http.HttpServletRequest)
Modifier and Type | Method and Description |
---|---|
Locale |
resolveLocale(javax.portlet.PortletRequest request)
Resolve the current locale via the given request.
|
void |
setLocale(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response,
Locale locale)
Set the current locale to the given one.
|
Locale resolveLocale(javax.portlet.PortletRequest request)
request
- the request to resolve the locale fornull
)void setLocale(javax.portlet.PortletRequest request, @Nullable javax.portlet.PortletResponse response, @Nullable Locale locale)
request
- the request to be used for locale modificationresponse
- the response to be used for locale modificationlocale
- the new locale, or null
to clear the localeUnsupportedOperationException
- if the LocaleResolver implementation does not support dynamic changing of
the localeCopyright © 2019 Liferay, Inc.. All rights reserved.