On Wed, 2008-05-21 at 10:02 -0700, hbMailingList wrote:
> Hello, I was reading the performance wiki page, and it is suggesting that
> SERIALIZE_STATE_IN_SESSION should be set to false.
> 
> I had 2 questions: 
>  1. What does this flag actually do?  Does this mean the view and its
> component tree is not saved in the session?  What 'state' is it refering it?
>  2. Why doesn't this flag apply to client side state management?
> 
> Thanks in advance

When state is saved client-side, the tree state is turned into a byte
array, then base64-encoded, and that byte array is then embedded in a
hidden field in each form.

When state is saved server-side, the normal behaviour is to first turn
it into a byte array, then save that byte array in the session.

When the SERIALIZE_STATE_IN_SESSION flag is set to false, then the tree
state is not turned into a byte array; instead just a reference to the
tree root is stored in the http session. This is faster (all the work of
turning the tree into a byte-array is saved, and restore-view just
retrieves the original reference). It also allows objects in the view
tree which do not implement StateHolder or java.io.Seriaolizable.  But
this can affect the behaviour of components if they are assuming that
saveState/restoreState are called. And it means that if you later enable
webapp clustering or client-side-state then you can get some nasty
surprises if some objects in the session are not actually serializable.
And it might take more memory (not sure about that).

Regards,
Simon

Reply via email to