Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1-SNAPSHOT
    • Fix Version/s: 1.2.2
    • Component/s: None
    • Labels:
      None

      Description

      As the topic suggests, the state gets reconstructed twice during the Restore View phase. State reconstruction consists of decoding, decrypting and decompressing (assuming that MyFaces has been configured to do so) the given state (i.e. the "javax.faces.ViewState" request parameter) so it shouldn't be done more often than necessary. For a better understanding of this issue, I'll describe the call hierarchy (simplified):

      ///

      // myfaces/core/branches/1_2_1/impl/org/apache/myfaces/application/jsp/JspStateManagerImpl.java

      public UIViewRoot restoreView(FacesContext context, String viewId, String renderKitId) {
      ...
      if (isSavingStateInClient(context))

      { ... state = responseStateManager.getState(context, viewId); }

      ...
      }

      // myfaces/core/branches/1_2_1/api/javax/faces/render/ResponseStateManager.java

      public Object getState(FacesContext context, String viewId) {
      Object[] structureAndState = new Object[2];
      structureAndState[0] = getTreeStructureToRestore(context, viewId);
      structureAndState[1] = getComponentStateToRestore(context);
      return structureAndState;
      }

      // myfaces/core/branches/1_2_1/impl/org/apache/myfaces/renderkit/html/HtmlResponseStateManager.java

      public Object getTreeStructureToRestore(FacesContext facesContext, String viewId) {
      ...
      Object encodedState = requestParameterMap.get("javax.faces.ViewState");
      Object[] savedState = (Object[]) StateUtils.reconstruct((String) encodedState, ...);
      ...
      return savedState[TREE_PARAM];
      }

      public Object getComponentStateToRestore(FacesContext facesContext) {
      ...
      Object encodedState = requestParameterMap.get("javax.faces.ViewState");
      Object[] savedState = (Object[]) StateUtils.reconstruct((String) encodedState, ...);
      ...
      return savedState[STATE_PARAM];
      }

      \\\

      One possible solution (without breaking backward compatibility) is to override javax.faces.render.ResponseStateManager#getState(FacesContext, String) and that's exactly what I've done. I've tested my patch with the MyFaces Tomahawk examples on my notebook (Ubuntu 7.04, AMD Turion 1.80 GHz, 1.5 GB DDR). Additionally, I'll attach a Apache JMeter test configuration and results of this test using a local Jetty server. I'd appreciate someone backing up my test results.

      1. MYFACES-1701.patch
        4 kB
        Bernhard Huemer
      2. tests.zip
        11 kB
        Bernhard Huemer

        Activity

        Hide
        Bernhard Huemer added a comment -

        Apache JMeter Test & results

        Show
        Bernhard Huemer added a comment - Apache JMeter Test & results
        Hide
        Martin Marinschek added a comment -

        Another good catch. There we talk about performance, and then we do this

        regards,

        Martin

        Show
        Martin Marinschek added a comment - Another good catch. There we talk about performance, and then we do this regards, Martin

          People

          • Assignee:
            Martin Marinschek
            Reporter:
            Bernhard Huemer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development