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

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin

    desc, name
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onDestroy(org.exoplatform.web.application.Application app)
     
    void
    onEndRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context)
    Save any locale change - to cookie for anonymous users, to profile for logged-in users
    void
    onFailRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context, org.exoplatform.web.application.RequestFailure failureType)
     
    void
    onInit(org.exoplatform.web.application.Application app)
     
    void
    onStartRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context)
    Initialize Locale to be used for the processing of current request

    Methods inherited from class org.exoplatform.container.component.BaseComponentPlugin

    getDescription, getName, setDescription, setName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • LocalizationLifecycle

      public LocalizationLifecycle()
  • Method Details

    • onInit

      public void onInit(org.exoplatform.web.application.Application app) throws Exception
      Specified by:
      onInit in interface org.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>
      Throws:
      Exception
      See Also:
      • ApplicationLifecycle.onInit(org.exoplatform.web.application.Application)
    • 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:
      onStartRequest in interface org.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>
      Throws:
      Exception
      See Also:
      • ApplicationLifecycle.onStartRequest(org.exoplatform.web.application.Application, E)
    • 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:
      onEndRequest in interface org.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>
      Throws:
      Exception
      See Also:
      • ApplicationLifecycle.onEndRequest(org.exoplatform.web.application.Application, E)
    • onFailRequest

      public void onFailRequest(org.exoplatform.web.application.Application app, WebuiRequestContext context, org.exoplatform.web.application.RequestFailure failureType)
      Specified by:
      onFailRequest in interface org.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>
      See Also:
      • ApplicationLifecycle.onFailRequest(org.exoplatform.web.application.Application, E, org.exoplatform.web.application.RequestFailure)
    • onDestroy

      public void onDestroy(org.exoplatform.web.application.Application app) throws Exception
      Specified by:
      onDestroy in interface org.exoplatform.web.application.ApplicationLifecycle<WebuiRequestContext>
      Throws:
      Exception
      See Also:
      • ApplicationLifecycle.onDestroy(org.exoplatform.web.application.Application)