You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Cristi Toth <cr...@gmail.com> on 2007/11/23 16:08:31 UTC

state saving (StateManager) and multiple frames (HACKATHON points 4 and 6)

Hi all!

Point 4 on Hackathon list (http://wiki.apache.org/myfaces/Hackathon_2007) :
- look at supporting multiple concurrent windows in
MyFaces<http://wiki.apache.org/myfaces/MyFaces>with server-side state.
Currently AFAIK there is only one viewstate pool,
not one per window, so using one window can force the state backing the
other window to be discarded. This may overlap with the "externalise view
cache" proposal currently logged as a JIRA issue.

We already started doing this for one of our customers
and of course thought that this would be a nice feature to add in MyFaces.

The simple solution we thought about consists of the following:
- in JspStateManagerImpl :
  - adding frameId attribute to the protected class SerializedViewKey
(similar to the sequenceId attribute)
  - in the protected class SerializedViewCollection
     - transforming the _keys list into a matrix, where each line stores the
keys corresponding to a frameId
     - defining a context param "DEFAULT_NUMBER_OF_FRAMES_IN_SESSION"
     - changing DEFAULT_NUMBER_OF_VIEWS_IN_SESSION to
DEFAULT_NUMBER_OF_VIEWS_FOR_FRAME
- in HtmlResponseStateManager
     - adding an array item containing the frameId to the saveState array
(in all the methods)

I think this will solve the problem with having multiple frames

Then I noticed point 6 on the Hackathon wiki page:
- clean up the state-saving code (JsfStateManagerImpl,
HtmlResponseStateManager). Currently, every state option has been
implemented by adding code to these classes. It would be nice to instead
have a separate subclass per "strategy"; see INIT_PARAM_VIEWSTATE_JAVASCRIPT
implementation for an ugly example. This then enables easier
implementation/experimentation with new strategies.

I totally agree with this.
Can you give us some ideas how to decouple this code?
And how to add the capability for programmers to change the "state saving
strategy" ?

Thanks for any advices,
-- 
Cristi Toth

-------------
Codebeat
www.codebeat.ro