Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3563 Improvements in State Saving Algorithm
  3. MYFACES-3567

[perf] do not include empty delta state array in both client side and server side state saving

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0.15, 2.1.9
    • JSR-314
    • None

    Description

      With the improvements done in PSS, it is usual to find view without delta state. Such views passes an empty object array with two null slots.

      private static final Object[] EMPTY_STATES = new Object[]

      {null, null};

      The tricky part here is when the algorithm that restore the state returns null, a ViewExpiredException is thrown. In this case the empty array identifies a view with zero delta, but we don't want to store that empty array into the state for both client side and server side state saving.

      Instead, we can store just a null value into the state and add some code that check the condition and convert that null value to an empty array when the view is restored and viceversa. In JSF 1.2 state saving the state is never null, so the old code will continue working. If saveState is called passing a null instance, we can store the empty array into the state and then check for that condition to return the null value (which is invalid and cause ViewExpiredException anyway).

      So, at the end we are just "switching" null and new Object[]{null, null}

      before store them into the state, but all that will be benefical, because a call to saveState with null state is invalid, but the call with empty object array, which has meaning and is more frequently in views does not produce additional state.

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: