ICEfaces
  1. ICEfaces
  2. ICE-11502

Implement robust window tracking via URL rewriting

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.3, EE-3.3.0.GA_P07, EE-4.3.0.GA_P02
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.)

      Description

      Implement window tracking to ensure a reliable window scope that can cope with window reload and back and forward window navigation.

        Activity

        Hide
        Mircea Toma added a comment - - edited

        The obvious window tracking implementation is one based on URL rewriting. This will ensure that a window will be identified by a unique URL.
        Having two windows A and be B their corresponding URLs will look like http://host:port/context/file.jsf?jsfwid=A and http://host:port/context/file.jsf?jsfwid=B. Even though both windows show the same view they can have different states (captured by the window scope beans).

        The advantages of using URL rewriting are:

        • The window can still be tracked after a window reload, the browser will send a GET request using the URL that contains the window identifier.
        • The window is still tracked when a navigation is triggered, the URLs rendered by the application will all contain the window identifier.
        • The URL rewriting can be implemented by using the API that is available in JSF (encodeActionURL(url)).
        • ICEfaces can use the URL rewriting based window tracking that is already provided by JSF and implement only the window scope management (which is missing from JSF).
        • The bridge will need minor changes to send the window identifier into a format recognised by JSF.

        The disadvantages of using URL rewriting are:

        • Components that render URLs to other views need to be updated to encode the window identifier.
        • Confusions can occur when the URL of the page is copied and used in another window, thus having two windows tracked by the same identifier. Certain strategies can be added to eliminate this duplication.
        • More complex URLs, deployments that use reverse proxies or servlet filters will have to account for the new URL pattern.
        Show
        Mircea Toma added a comment - - edited The obvious window tracking implementation is one based on URL rewriting. This will ensure that a window will be identified by a unique URL. Having two windows A and be B their corresponding URLs will look like http://host:port/context/file.jsf?jsfwid=A and http://host:port/context/file.jsf?jsfwid=B . Even though both windows show the same view they can have different states (captured by the window scope beans). The advantages of using URL rewriting are: The window can still be tracked after a window reload, the browser will send a GET request using the URL that contains the window identifier. The window is still tracked when a navigation is triggered, the URLs rendered by the application will all contain the window identifier. The URL rewriting can be implemented by using the API that is available in JSF ( encodeActionURL(url) ). ICEfaces can use the URL rewriting based window tracking that is already provided by JSF and implement only the window scope management (which is missing from JSF). The bridge will need minor changes to send the window identifier into a format recognised by JSF. The disadvantages of using URL rewriting are: Components that render URLs to other views need to be updated to encode the window identifier. Confusions can occur when the URL of the page is copied and used in another window, thus having two windows tracked by the same identifier. Certain strategies can be added to eliminate this duplication. More complex URLs, deployments that use reverse proxies or servlet filters will have to account for the new URL pattern.
        Hide
        Mircea Toma added a comment -

        Factored out strategies used by ICEfaces to track the window scope. Implemented window scope management using the window tracking provided by JSF (URL based).

        Show
        Mircea Toma added a comment - Factored out strategies used by ICEfaces to track the window scope. Implemented window scope management using the window tracking provided by JSF (URL based).
        Hide
        Mircea Toma added a comment -

        Moved Liferay specific code into TimeBasedWindowScopeTracker as sub-strategy for tracking window ID (instead of having it as a top level strategy).

        Show
        Mircea Toma added a comment - Moved Liferay specific code into TimeBasedWindowScopeTracker as sub-strategy for tracking window ID (instead of having it as a top level strategy).
        Hide
        Mircea Toma added a comment -

        Improve URL tracking by adding window ID parameter to the URL of the loaded page (without triggering a reload) and thus allow an immediate reload of the page without window scope re-creation.

        Show
        Mircea Toma added a comment - Improve URL tracking by adding window ID parameter to the URL of the loaded page (without triggering a reload) and thus allow an immediate reload of the page without window scope re-creation.
        Hide
        Mircea Toma added a comment -

        Tested successfully Liferay substrategy using liferay-portal-6.2.0-ce-ga1 and liferay-faces-bridge-api-4.2.5-ga6.

        Show
        Mircea Toma added a comment - Tested successfully Liferay substrategy using liferay-portal-6.2.0-ce-ga1 and liferay-faces-bridge-api-4.2.5-ga6 .
        Hide
        Mircea Toma added a comment -

        To enable URL based window tracking and at the same time URL window management scope, one should set the JSF context parameter like:

        <context-param>
          <param-name>javax.faces.CLIENT_WINDOW_MODE</param-name>
          <param-value>url</param-value>
        </context-param>
        
        Show
        Mircea Toma added a comment - To enable URL based window tracking and at the same time URL window management scope, one should set the JSF context parameter like: <context-param> <param-name>javax.faces.CLIENT_WINDOW_MODE</param-name> <param-value>url</param-value> </context-param>
        Hide
        Ken Fyten added a comment -

        Re-opened.

        This solution needs to be backported to work with the EE 3.3.0.GA_P08 release as well. We also have a lead customer on EE 3.3 waiting to test it for us to resolve their Window scope issue.

        Show
        Ken Fyten added a comment - Re-opened. This solution needs to be backported to work with the EE 3.3.0.GA_P08 release as well. We also have a lead customer on EE 3.3 waiting to test it for us to resolve their Window scope issue.
        Hide
        Mircea Toma added a comment -

        Re-introduced lookupAssociatedWindowID public method. Save windowID into request map for both window tracking implementations.

        Show
        Mircea Toma added a comment - Re-introduced lookupAssociatedWindowID public method. Save windowID into request map for both window tracking implementations.
        Hide
        Mircea Toma added a comment -

        Ported the new implementation to icefaces-ee-3.3.0.GA-maintenance branch.

        Show
        Mircea Toma added a comment - Ported the new implementation to icefaces-ee-3.3.0.GA-maintenance branch.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: