public interface PortletLocaleContextResolver extends PortletLocaleResolver
LocaleResolver
, adding support for a rich locale context (potentially including locale and time
zone information).LocaleContext
,
TimeZoneAwareLocaleContext
,
LocaleContextHolder
,
RequestContext.getTimeZone()
,
RequestContextUtils.getTimeZone(javax.servlet.http.HttpServletRequest)
Modifier and Type | Method and Description |
---|---|
LocaleContext |
resolveLocaleContext(javax.portlet.PortletRequest request)
Resolve the current locale context via the given request.
|
void |
setLocaleContext(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response,
LocaleContext localeContext)
Set the current locale context to the given one, potentially including a locale with associated time zone
information.
|
resolveLocale, setLocale
LocaleContext resolveLocaleContext(javax.portlet.PortletRequest request)
This is primarily intended for framework-level processing; consider using RequestContextUtils
or RequestContext
for application-level access to the current locale and/or
time zone.
The returned context may be a TimeZoneAwareLocaleContext
, containing
a locale with associated time zone information. Simply apply an instanceof
check and downcast
accordingly.
Custom resolver implementations may also return extra settings in the returned context, which again can be accessed through downcasting.
request
- the request to resolve the locale context fornull
PortletLocaleResolver.resolveLocale(PortletRequest)
,
RequestContextUtils.getLocale(javax.servlet.http.HttpServletRequest)
,
RequestContextUtils.getTimeZone(javax.servlet.http.HttpServletRequest)
void setLocaleContext(javax.portlet.PortletRequest request, @Nullable javax.portlet.PortletResponse response, @Nullable LocaleContext localeContext)
request
- the request to be used for locale modificationresponse
- the response to be used for locale modificationlocaleContext
- the new locale context, or null
to clear the localeUnsupportedOperationException
- if the LocaleResolver implementation does not support dynamic changing of
the locale or time zonePortletLocaleResolver.setLocale(PortletRequest, PortletResponse, Locale)
,
SimpleLocaleContext
,
SimpleTimeZoneAwareLocaleContext
Copyright © 2019 Liferay, Inc.. All rights reserved.