Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-1753

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0.6, 2.1.0
    • None
    • None

    Description

      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.

      Attachments

        1. no_buffer.diff
          19 kB
          Mario Ivankovits

        Issue Links

          Activity

            People

              lu4242 Leonardo Uribe
              imario Mario Ivankovits
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: