Do not require to buffer the output with server-side-state-saving
-----------------------------------------------------------------

                 Key: MYFACES-1753
                 URL: https://issues.apache.org/jira/browse/MYFACES-1753
             Project: MyFaces Core
          Issue Type: Improvement
            Reporter: Mario Ivankovits
            Assignee: Mario Ivankovits
         Attachments: no_buffer.diff

Attached you will find a patch against MyFaces 1.2.1 head which will eliminate 
the need to buffer the output to write in the ViewState hidden field when using 
Server-Side-State-Saving.

With SSSS just a sequence number (previously jsf_sequence) will be written into 
the ViewState hidden field.
This patch changes just this, and avoid the use of the StateAwareWriter. The 
restore process based on the jsf_sequence already worked, just minor 
restructuring to get the next sequence number early.

When using Facelets, you'll also need a ViewHandler with the following content:

        public void renderView(FacesContext context, UIViewRoot uiRoot) throws 
IOException, FacesException
        {
                StateManager stateManager = 
context.getApplication().getStateManager();

                original.renderView(context, uiRoot);

                stateManager.saveView(context);
        }

        public void writeState(FacesContext context) throws IOException
        {
                StateManager stateManager = 
context.getApplication().getStateManager();
                if (stateManager.isSavingStateInClient(context))
                {
                        original.writeState(context);
                }
                else
                {
                        stateManager.writeState(context, new Object[2]);
                }
        }

This disables the Facelets own state handling and ensures we save the view 
after rendering.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to