myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dora Rajappan (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (MYFACES-3804) Use the same key in server side state saving for ajax requests
Date Mon, 04 Nov 2013 11:53:18 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-3804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13812783#comment-13812783
] 

Dora Rajappan commented on MYFACES-3804:
----------------------------------------

Including relevant comments from 3816
What have you decided about the current behaviour of ajax redirect loosing state information
when changes are executed with redirect? Have you decided to flag in redirect and write it
in response after save state in rendering phase?

And this behaviour true for redirect via navigation handler. In render phase it goes to response
complete and state saving is avoided.

<h:commandButton action="#
{bean.action}" value="Invoke and redirect">
 <f:ajax execute="@this"/>
 </h:commandButton> 

 <navigation-rules>
 <navigation-rule>
 <from-view-id>/form.xhtml</from-view-id>
 <navigation-case>
 <from-action>#{bean.action} 
</from-action>
 <from-outcome>success</from-outcome>
 <to-view-id>/target.xhtml</to-view-id>
 <redirect/>
 </navigation-case>
 </navigation-rule>
 </navigation-rules> 

@RequestScoped @ManagedBean
 public class Bean {
 public String action() 
{ return "success"; } 
} 

I think its a good idea to follow client side state saving behaviour for ajax redirect. 


> Use the same key in server side state saving for ajax requests
> --------------------------------------------------------------
>
>                 Key: MYFACES-3804
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3804
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-344
>            Reporter: Leonardo Uribe
>         Attachments: ajaxviewkey.patch, ajaxviewkeytest.patch, ajaxviewkeytest2.patch
>
>
> The current code for server side state saving creates one key per request to store the
view state. This is ok, but it is not necessary for ajax requests. 
> The reason why is not necessary is because you can never go back to a page when using
ajax. If you are on page A and the current request is an ajax request and it returns to the
same page and the view is the same that the one that has been restored, the key or the token
sent does not need to change, what changes is the internal state of the view. From the client
side the page is the same. We can take advantage of this fact and just update the state stored
in SerializedViewCollection for the view. 
> The challenge here is detect when this strategy is applicable. For example, what happen
if there is an ajax redirect? It looks is a good idea for implement in 2.2, because it avoids
to store unnecessary information into session and optimize the use of each view slot. 



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message