You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2012/06/11 11:23:42 UTC

[jira] [Created] (MYFACES-3567) [perf] do not include empty delta state array in both client side and server side state saving

Leonardo Uribe created MYFACES-3567:
---------------------------------------

             Summary: [perf] do not include empty delta state array in both client side and server side state saving
                 Key: MYFACES-3567
                 URL: https://issues.apache.org/jira/browse/MYFACES-3567
             Project: MyFaces Core
          Issue Type: Sub-task
          Components: JSR-314
            Reporter: Leonardo Uribe
            Assignee: Leonardo Uribe


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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (MYFACES-3567) [perf] do not include empty delta state array in both client side and server side state saving

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-3567?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe resolved MYFACES-3567.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.9
                   2.0.15
    
> [perf] do not include empty delta state array in both client side and server side state saving
> ----------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3567
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3567
>             Project: MyFaces Core
>          Issue Type: Sub-task
>          Components: JSR-314
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.15, 2.1.9
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira