glassfish
  1. glassfish
  2. GLASSFISH-20433

Faces Flows: Automatic enabling of client window mode doesn't work unless XML defined flows exists

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: jsf
    • Labels:
      None

      Description

      ClientWindow mode must be enabled for Faces Flows to work.

      The JSF spec requires that client window mode must be automatically enabled if one or more flows are detected. This automatic enabling only works if at least one of the flows is defined in XML.

        Activity

        Hide
        Ed Burns added a comment -

        The workaround is to manually enable ClientWindow mode in web.xml:

        <context-param>
        <param-name>javax.faces.CLIENT_WINDOW_MODE</param-name>
        <param-value>url</param-value>
        </context-param>

        Show
        Ed Burns added a comment - The workaround is to manually enable ClientWindow mode in web.xml: <context-param> <param-name>javax.faces.CLIENT_WINDOW_MODE</param-name> <param-value>url</param-value> </context-param>
        Hide
        Ed Burns added a comment -
        • What is the impact on the customer of the bug?

        How likely is it that a customer will see the bug and how serious is the bug?

        This bug only shows up when using Faces Flows, and only when there are no XML based flows, only Java based flows.

        Is it a regression?

        No

        Does it meet other bug fix criteria (security, performance, etc.)?

        What CTS failures are caused by this bug?

        None

        • What is the cost/risk of fixing the bug?

        How risky is the fix?

        Minimal. Small change to one source file at a leaf node in the call stack.

        How much work is the fix?

        Use the same logic in the XML auto-enabling to achieve Java auto enabling.

        Is the fix complicated?

        No

        • Is there an impact on documentation or message strings?

        No

        • Which tests should QA (re)run to verify the fix did not destabilize GlassFish?

        Flow tests.

        • Which is the targeted build of 4.0 for this fix?

        b87

        • If this an integration of a new version of a component from another project,
          what are the changes that are being brought in? This might be list of
          Jira issues from that project or a list of revision messages.

        this is the main JIRA for this issue.

        Show
        Ed Burns added a comment - What is the impact on the customer of the bug? How likely is it that a customer will see the bug and how serious is the bug? This bug only shows up when using Faces Flows, and only when there are no XML based flows, only Java based flows. Is it a regression? No Does it meet other bug fix criteria (security, performance, etc.)? What CTS failures are caused by this bug? None What is the cost/risk of fixing the bug? How risky is the fix? Minimal. Small change to one source file at a leaf node in the call stack. How much work is the fix? Use the same logic in the XML auto-enabling to achieve Java auto enabling. Is the fix complicated? No Is there an impact on documentation or message strings? No Which tests should QA (re)run to verify the fix did not destabilize GlassFish? Flow tests. Which is the targeted build of 4.0 for this fix? b87 If this an integration of a new version of a component from another project, what are the changes that are being brought in? This might be list of Jira issues from that project or a list of revision messages. this is the main JIRA for this issue.
        Hide
        Ed Burns added a comment -

        Index: jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java
        ===================================================================
        — jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java (revision 11915)
        +++ jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java (working copy)
        @@ -323,6 +323,9 @@
        FlowDiscoveryCDIContext flowDiscoveryContext = (FlowDiscoveryCDIContext) beanManager.getContext(FlowDefinition.class);
        List<Producer<Flow>> flowProducers = flowDiscoveryContext.getFlowProducers();
        WebConfiguration config = WebConfiguration.getInstance();
        + if (!flowProducers.isEmpty())

        { + enableClientWindowModeIfNecessary(context); + }

        for (Producer<Flow> cur : flowProducers)

        { Flow toAdd = cur.produce(beanManager.<Flow>createCreationalContext(null)); @@ -338,9 +341,26 @@ }
        • + private void enableClientWindowModeIfNecessary(FacesContext context) {
          +
          + WebConfiguration config = WebConfiguration.getInstance(context.getExternalContext());
          +
          + String optionValue = config.getOptionValue(WebConfiguration.WebContextInitParameter.ClientWindowMode);
          + boolean clientWindowNeedsEnabling = false;
          + if ("none".equals(optionValue))

          Unknown macro: {+ clientWindowNeedsEnabling = true;+ String featureName = + WebConfiguration.WebContextInitParameter.ClientWindowMode.getQualifiedName();+ LOGGER.log(Level.WARNING, + "{0} was set to none, but Faces Flows requires {0} is enabled. Setting to ''url''.", new Object[]{featureName});+ }

          else if (null == optionValue)

          { + clientWindowNeedsEnabling = true; + }

          + if (clientWindowNeedsEnabling)

          { + config.setOptionValue(WebConfiguration.WebContextInitParameter.ClientWindowMode, "url"); + }

          + }

        • }

        public void initializeFacelets() {

        Show
        Ed Burns added a comment - Index: jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java =================================================================== — jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java (revision 11915) +++ jsf-ri/src/main/java/com/sun/faces/application/ApplicationAssociate.java (working copy) @@ -323,6 +323,9 @@ FlowDiscoveryCDIContext flowDiscoveryContext = (FlowDiscoveryCDIContext) beanManager.getContext(FlowDefinition.class); List<Producer<Flow>> flowProducers = flowDiscoveryContext.getFlowProducers(); WebConfiguration config = WebConfiguration.getInstance(); + if (!flowProducers.isEmpty()) { + enableClientWindowModeIfNecessary(context); + } for (Producer<Flow> cur : flowProducers) { Flow toAdd = cur.produce(beanManager.<Flow>createCreationalContext(null)); @@ -338,9 +341,26 @@ } + private void enableClientWindowModeIfNecessary(FacesContext context) { + + WebConfiguration config = WebConfiguration.getInstance(context.getExternalContext()); + + String optionValue = config.getOptionValue(WebConfiguration.WebContextInitParameter.ClientWindowMode); + boolean clientWindowNeedsEnabling = false; + if ("none".equals(optionValue)) Unknown macro: {+ clientWindowNeedsEnabling = true;+ String featureName = + WebConfiguration.WebContextInitParameter.ClientWindowMode.getQualifiedName();+ LOGGER.log(Level.WARNING, + "{0} was set to none, but Faces Flows requires {0} is enabled. Setting to ''url''.", new Object[]{featureName});+ } else if (null == optionValue) { + clientWindowNeedsEnabling = true; + } + if (clientWindowNeedsEnabling) { + config.setOptionValue(WebConfiguration.WebContextInitParameter.ClientWindowMode, "url"); + } + } } public void initializeFacelets() {
        Hide
        Tom Mueller added a comment -

        Approved for 4.0.

        Show
        Tom Mueller added a comment - Approved for 4.0.
        Hide
        Ed Burns added a comment -

        Running automated tests against this fix now.

        Show
        Ed Burns added a comment - Running automated tests against this fix now.
        Show
        Ed Burns added a comment - - edited Safe to integrate to GlassFish 4.0 when < http://slc03qna.us.oracle.com:7070/hudson/view/Mojarra%202.2/job/2_2_x-test-glassfish-4_0/97/ > and < http://hudson-sca.us.oracle.com/view/MOJARRA_ALL/job/MOJARRA_2_2_0_GLASSFISH_3_1_2_2_NO_CLUSTER/33/ > are clean. Both are clean.
        Hide
        Ed Burns added a comment -

        svn commit -m "Integrate Mojarra 2.2.0 Final and JSF API 2.2 Final" appserver/pom.xml
        Sending appserver/pom.xml
        Transmitting file data .
        Committed revision 61873.

        Show
        Ed Burns added a comment - svn commit -m "Integrate Mojarra 2.2.0 Final and JSF API 2.2 Final" appserver/pom.xml Sending appserver/pom.xml Transmitting file data . Committed revision 61873.

          People

          • Assignee:
            Ed Burns
            Reporter:
            Ed Burns
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 2 hours Original Estimate - 2 hours
              2h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 3 hours, 20 minutes
              3h 20m