ICEfaces
  1. ICEfaces
  2. ICE-5594

Make sure only one view state key is generate per page load

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha2
    • Fix Version/s: 2.0-Alpha3, 2.0.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      server

      Description

       To avoid any subtle issues in the future we need to make sure only one view state key is generate per page load. Right now, during page load, com.sun....FormRender and BridgeSetup generate a view state key by calling StateManager.getViewState method. When the view is handled by ICEfaces it will modify the forms within the page to use the key generated by the form renderer.

        Activity

        Mircea Toma created issue -
        Mircea Toma made changes -
        Field Original Value New Value
        Salesforce Case []
        Fix Version/s 2.0-Beta [ 10231 ]
        Description  To avoid any subtle future issues in the future we need to make sure only one view state key is generate per page load. Right now com.sun....FormRender and BridgeSetup generate a view state key by calling StateManager.getViewState method. When the view is handled by ICEfaces it will modify the forms within the page to use the key generated by the form renderer.  To avoid any subtle issues in the future we need to make sure only one view state key is generate per page load. Right now, during page load, com.sun....FormRender and BridgeSetup generate a view state key by calling StateManager.getViewState method. When the view is handled by ICEfaces it will modify the forms within the page to use the key generated by the form renderer.
        Assignee Mircea Toma [ mircea.toma ]
        Hide
        Ted Goddard added a comment -

        Currently the script UIOutput components are prepared with the static value of the ViewState key at the time they are added to the component tree. It should be possible to create a UIOutput that dynamically produces its value from the ViewState key at the time of rendering. (It is still possible for the component tree to be altered during the render phase, but the risk is at least reduced.)

        It may also make sense to allow a mode where the value is looked up in the browser from javax.faces.ViewState. This would work well in the Servlet case when forms are present, so could be the default mode.

        Show
        Ted Goddard added a comment - Currently the script UIOutput components are prepared with the static value of the ViewState key at the time they are added to the component tree. It should be possible to create a UIOutput that dynamically produces its value from the ViewState key at the time of rendering. (It is still possible for the component tree to be altered during the render phase, but the risk is at least reduced.) It may also make sense to allow a mode where the value is looked up in the browser from javax.faces.ViewState. This would work well in the Servlet case when forms are present, so could be the default mode.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #21238 Thu Apr 15 15:53:20 MDT 2010 mircea.toma ICE-5594 Render form to use its view state key for ice.singleSubmit and ice.retreiveUpdate. Introduce convention to pair view ID with view state key.
        Files Changed
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/javascript/application.js
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/javascript/submit.js
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/BridgeSetup.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #21239 Thu Apr 15 16:19:30 MDT 2010 mircea.toma ICE-5594 Add comment.
        Files Changed
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/BridgeSetup.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #21246 Fri Apr 16 08:18:41 MDT 2010 mircea.toma ICE-5594 Simplify client side push setup.
        Files Changed
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/javascript/application.js
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/BridgeSetup.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #21247 Fri Apr 16 09:11:47 MDT 2010 mircea.toma ICE-5594 Remove semicolon.
        Files Changed
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/javascript/application.js
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #21248 Fri Apr 16 09:15:34 MDT 2010 mircea.toma ICE-5594 Remove obsolete inline comment.
        Files Changed
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/javascript/application.js
        Hide
        Mircea Toma added a comment -

        It seems that the default JSF state manager will not return the same view state key when StateManager.getViewState method is invoked multiple times during the page load (not postaback). This means that the view state key cannot be accessed programmatically on the server side.

        Both ice.singleSubmit and ice.retrieveUpdate functions need a valid view state key which should be the same with the key the forms receive when they are rendered (they receive it through a complicated mechanism – see com.sun.faces.application.ViewHandlerImpl$WriteBehindStateWriter). To solve this without having to write any code that would depend on com.sun.faces.* classes we always append a UIForm component to the component tree. This way the there is always a form that can be looked up on the client side to use its view state key.
        The appended form, as a convention, has its ID value the same with the generated viewID. When ice.singleSubmit is invoked it will lookup the form based on this ID an use it to send event data along with the correct javax.faces.ViewState value (already included in the form). ice.ice.retrieveUpdate uses the viewID as pushID, it too can lookup easily the form and use it as well to initiate a request that uses the proper view state key.

        Show
        Mircea Toma added a comment - It seems that the default JSF state manager will not return the same view state key when StateManager.getViewState method is invoked multiple times during the page load (not postaback). This means that the view state key cannot be accessed programmatically on the server side. Both ice.singleSubmit and ice.retrieveUpdate functions need a valid view state key which should be the same with the key the forms receive when they are rendered (they receive it through a complicated mechanism – see com.sun.faces.application.ViewHandlerImpl$WriteBehindStateWriter). To solve this without having to write any code that would depend on com.sun.faces.* classes we always append a UIForm component to the component tree. This way the there is always a form that can be looked up on the client side to use its view state key. The appended form, as a convention, has its ID value the same with the generated viewID. When ice.singleSubmit is invoked it will lookup the form based on this ID an use it to send event data along with the correct javax.faces.ViewState value (already included in the form). ice.ice.retrieveUpdate uses the viewID as pushID, it too can lookup easily the form and use it as well to initiate a request that uses the proper view state key.
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Mircea Toma added a comment -

        Simplified ICEpush setup on client side to reduce the amount of markup.

        Show
        Mircea Toma added a comment - Simplified ICEpush setup on client side to reduce the amount of markup.
        Ken Fyten made changes -
        Salesforce Case []
        Fix Version/s 2.0-Alpha3 [ 10032 ]
        Fix Version/s 2.0-Beta [ 10231 ]
        Ken Fyten made changes -
        Fix Version/s 2.0.0 [ 10230 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Mircea Toma
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: