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

        Bernhard Huemer created issue -
        Bernhard Huemer made changes -
        Field Original Value New Value
        Attachment MYFACES.patch [ 12363534 ]
        Bernhard Huemer made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Bernhard Huemer made changes -
        Attachment MYFACES-1701.patch [ 12363536 ]
        Bernhard Huemer made changes -
        Attachment MYFACES.patch [ 12363534 ]
        Hide
        Bernhard Huemer added a comment -

        Apache JMeter Test & results

        Show
        Bernhard Huemer added a comment - Apache JMeter Test & results
        Bernhard Huemer made changes -
        Attachment tests.zip [ 12363537 ]
        Martin Marinschek made changes -
        Assignee Martin Marinschek [ mmarinschek ]
        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
        Martin Marinschek made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 1.2.1-SNAPSHOT [ 12312571 ]
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Leonardo Uribe made changes -
        Fix Version/s 1.2.1-SNAPSHOT [ 12312571 ]
        Fix Version/s 1.2.1 [ 12312895 ]
        Leonardo Uribe made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Leonardo Uribe made changes -
        Fix Version/s 1.2.1 [ 12312895 ]
        Fix Version/s 1.2.2 [ 12312932 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Patch Available Patch Available
        2m 3s 1 Bernhard Huemer 09/Aug/07 23:28
        Patch Available Patch Available Resolved Resolved
        2d 14h 25m 1 Martin Marinschek 12/Aug/07 13:54
        Resolved Resolved Closed Closed
        129d 6h 33m 1 Leonardo Uribe 19/Dec/07 19:27

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development