Class LocalizationLifecycle
java.lang.Object
org.exoplatform.container.component.BaseComponentPlugin
org.exoplatform.portal.application.localization.LocalizationLifecycle
- All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin,org.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>
public class LocalizationLifecycle
extends org.exoplatform.container.component.BaseComponentPlugin
implements org.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>
This class takes care of loading / initializing / saving the current Locale.
Current Locale is used to create properly localized response to current
request. At the beginning of request
LocalePolicy is used to
determine the initial Locale to be used for processing the request. This
Locale is then set on current
PortalRequestContext (it's
presumed that current RequestContext
is of type PortalRequestContext) by calling
PortalRequestContext.setLocale(java.util.Locale).
During request processing
PortalRequestContext.getLocale() is
the ultimate reference consulted by any rendering code that needs to know
about current Locale. When this Locale is changed during action processing,
the new Locale choice is saved into user's profile or into browser's cookie
in order to be used by future requests. This Lifecycle depends on
UserProfileLifecycle being registered before this one, as it relies on it for
loading the user profile. See WEB-INF/webui-configuration.xml in web/portal
module.- Author:
- Marko Strukelj
-
Field Summary
FieldsFields inherited from class org.exoplatform.container.component.BaseComponentPlugin
desc, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonDestroy(org.exoplatform.web.application.Application app) voidonEndRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context) Save any locale change - to cookie for anonymous users, to profile for logged-in usersvoidonFailRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context, org.exoplatform.web.application.RequestFailure failureType) voidonInit(org.exoplatform.web.application.Application app) voidonStartRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context) Initialize Locale to be used for the processing of current requestMethods inherited from class org.exoplatform.container.component.BaseComponentPlugin
getDescription, getName, setDescription, setName
-
Field Details
-
SAVE_PROFILE_LOCALE_ATTR
- See Also:
-
-
Constructor Details
-
LocalizationLifecycle
public LocalizationLifecycle()
-
-
Method Details
-
onInit
- Specified by:
onInitin interfaceorg.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>- Throws:
Exception- See Also:
-
onStartRequest
public void onStartRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context) throws Exception Initialize Locale to be used for the processing of current request- Specified by:
onStartRequestin interfaceorg.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>- Throws:
Exception- See Also:
-
onEndRequest
public void onEndRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context) throws Exception Save any locale change - to cookie for anonymous users, to profile for logged-in users- Specified by:
onEndRequestin interfaceorg.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>- Throws:
Exception- See Also:
-
onFailRequest
public void onFailRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context, org.exoplatform.web.application.RequestFailure failureType) - Specified by:
onFailRequestin interfaceorg.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>- See Also:
-
onDestroy
- Specified by:
onDestroyin interfaceorg.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>- Throws:
Exception- See Also:
-