Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-4401

Component locale-config (org.jboss.seam.international.localeConfig) does not set the locale things in JSF context if JSF is not initialized before Seam

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.2.0.GA, 2.2.1.CR1
    • Fix Version/s: 2.2.1.CR1
    • Component/s: None
    • Labels:
      None
    • Environment:

      WebSphere v7.0.0.5 (That is bundled with JSF-RI 1.2_07+)

    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      In web.xml, add
      <listener><listener-class>com.sun.faces.config.ConfigureListener</listener-class></listener>
      before
      <listener><listener-class>org.jboss.seam.servlet.SeamListener</listener-class></listener>

      Show
      In web.xml, add <listener><listener-class>com.sun.faces.config.ConfigureListener</listener-class></listener> before <listener><listener-class>org.jboss.seam.servlet.SeamListener</listener-class></listener>

      Description

      Using the localeConfig component by declaring <international:locale-config default-locale="fr" supported-locales="fr en" /> in component.xml does not work as-is.

      It works if JSF is initialized BEFORE Seam by adding the lines
      <listener><listener-class>com.sun.faces.config.ConfigureListener</listener-class></listener>
      before
      <listener><listener-class>org.jboss.seam.servlet.SeamListener</listener-class></listener>
      in web.xml

      If the JSF listener is not there, JSF is not initialized when Seam bootstraps its application scope components, and so the faces application context is not available

      In the case of the localeConfig component, line 136 of org.jboss.seam.international.LocaleConfig throws an IllegalStateException that is silently swallowed when JSF is not initialized
      Doing so the the default locales and supported locales are not defined to JSF thanks to the test in line 58.

      IMHO, at a minimum this should be stated in the doc that the component works only if JSF is initialized before seam, or somehting should be changed in the code to set the JSF locale things when JSF application context is initialized

      org.jboss.seam.international.LocaleConfig lines around 136:
      private Application getApplication()
      {
      try

      { ApplicationFactory factory = (ApplicationFactory) FactoryFinder .getFactory(FactoryFinder.APPLICATION_FACTORY); return factory.getApplication(); }

      catch (IllegalStateException e)

      { // just in case, for units and the like // if we can't do it, it just wan't meant to be return null; }

      }

      around line 58:
      @Create
      public void initLocaleConfig()
      {
      Application application = getApplication();
      if (application == null)

      { return; }

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  manaRH Marek Novotny
                  Reporter:
                  titou09 titou10 titou10
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: