ICEfaces
  1. ICEfaces
  2. ICE-6927

Refreshing a page redirects to index page

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0, 2.0.1, 2.0.2
    • Fix Version/s: 2.1-Beta, 3.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Windows XP, UnixAIX
      Tomcat6

      Description

      After refreshing a webpage by pressing F5, the application is redirected to index page.
      The session settings are kept well but you have to navigate to the position you've refreshed.
      The problem was observed after migrating from ICEFaces 1.8 to ICEFaces 2.0 and is still present in current release (2.0.2)

        Issue Links

          Activity

          Hide
          Mircea Toma added a comment -

          Looks like even in plain JSF deployments with AJAX enabled submission the page rendered after navigation and reload is the index page.

          Show
          Mircea Toma added a comment - Looks like even in plain JSF deployments with AJAX enabled submission the page rendered after navigation and reload is the index page.
          Hide
          Mircea Toma added a comment - - edited

          Introduced ReloadAfterNavigationFix navigation handler to record the triggered navigation in the window scope. Introduced also ReloadAfterNavigationFix$TriggerNavigation phase listener that will replay the recorded navigation for the current window. Modified WindowScopeManager.containsBeans function to return true only when the scope map contains objects with keys matching packages outside the core framework implementation to avoid disabling lazyWindowScope feature when the window scope map is used by the framework. Moved WindowScopeManager.containsBeans method into EnvUtils class since it's commonly used by BridgeSetup and WindowScopeManager.

          Show
          Mircea Toma added a comment - - edited Introduced ReloadAfterNavigationFix navigation handler to record the triggered navigation in the window scope. Introduced also ReloadAfterNavigationFix$TriggerNavigation phase listener that will replay the recorded navigation for the current window. Modified WindowScopeManager.containsBeans function to return true only when the scope map contains objects with keys matching packages outside the core framework implementation to avoid disabling lazyWindowScope feature when the window scope map is used by the framework. Moved WindowScopeManager.containsBeans method into EnvUtils class since it's commonly used by BridgeSetup and WindowScopeManager.
          Hide
          Ken Fyten added a comment -

          The commits for this change have resulted in the following nightly regression tests failing:

          New failures: springsecurity [All besides IE], ICE-4565 [All besides IE], ICE-2994 [FF & FF just-ice]

          Also, the scopes tests are now failing.

          Show
          Ken Fyten added a comment - The commits for this change have resulted in the following nightly regression tests failing: New failures: springsecurity [All besides IE] , ICE-4565 [All besides IE] , ICE-2994 [FF & FF just-ice] Also, the scopes tests are now failing.
          Hide
          Mircea Toma added a comment -

          The regression introduced is occurring during navigation triggered redirects. Once the redirecting navigation is sent the server will keep on sending the same redirect response. AS a safety issue the browser will eventually stop requesting the same URL over and over again.

          Show
          Mircea Toma added a comment - The regression introduced is occurring during navigation triggered redirects. Once the redirecting navigation is sent the server will keep on sending the same redirect response. AS a safety issue the browser will eventually stop requesting the same URL over and over again.
          Hide
          Mircea Toma added a comment -

          The fix records the navigation that needs to be replayed only for a non-redirect the navigation case.

          Show
          Mircea Toma added a comment - The fix records the navigation that needs to be replayed only for a non-redirect the navigation case.
          Hide
          Greg Dick added a comment -

          The current code fails the following navigation scenario. Using the nav test application under icefaces/samples/core/test/nav, if you navigate from page one to page two using the "Navigate using action=/page02" button (using ajax and non-redirecting navigation), then try to go back to page one using the "Navigate using action=nav.otherPageRedirect" button, the cases in the PhaseListener are all triggered. A NavigationInfo record is created after the first navigation, and the !isPostback() case in the following code is triggered on the redirection navagation back.

          public void afterPhase(PhaseEvent event) {
          FacesContext context = event.getFacesContext();
          if (!context.isPostback()) {
          Map map = WindowScopeManager.lookupWindowScope(context);
          NavigationInfo navigation = (NavigationInfo) map.get(NavigationKey);
          if (navigation != null)

          { navigation.navigate(context); }

          }
          }

          So you'll wind up with page01.xhtml in the URL bar, but the contents of page02 in the window. This will fail in all GET based navigation cases: anchor tags, Seam links, and Spring navigation links.

          Show
          Greg Dick added a comment - The current code fails the following navigation scenario. Using the nav test application under icefaces/samples/core/test/nav, if you navigate from page one to page two using the "Navigate using action=/page02" button (using ajax and non-redirecting navigation), then try to go back to page one using the "Navigate using action=nav.otherPageRedirect" button, the cases in the PhaseListener are all triggered. A NavigationInfo record is created after the first navigation, and the !isPostback() case in the following code is triggered on the redirection navagation back. public void afterPhase(PhaseEvent event) { FacesContext context = event.getFacesContext(); if (!context.isPostback()) { Map map = WindowScopeManager.lookupWindowScope(context); NavigationInfo navigation = (NavigationInfo) map.get(NavigationKey); if (navigation != null) { navigation.navigate(context); } } } So you'll wind up with page01.xhtml in the URL bar, but the contents of page02 in the window. This will fail in all GET based navigation cases: anchor tags, Seam links, and Spring navigation links.
          Hide
          Greg Dick added a comment -

          See above comment on redirection navigation cases.

          Show
          Greg Dick added a comment - See above comment on redirection navigation cases.
          Hide
          Ted Goddard added a comment -

          This feature makes use of the "safe" aspect of window scope (propagation only, not disposal). So, if we have a variant of windowScope without the onBeforeUnload POST, this should continue to function.

          Show
          Ted Goddard added a comment - This feature makes use of the "safe" aspect of window scope (propagation only, not disposal). So, if we have a variant of windowScope without the onBeforeUnload POST, this should continue to function.
          Hide
          Mircea Toma added a comment - - edited

          Introduced "org.icefaces.replayNavigationOnReload" context parameter to allow the disabling of the non-standard (but useful) behaviour. The parameter's value defaults to "true".

          Show
          Mircea Toma added a comment - - edited Introduced "org.icefaces.replayNavigationOnReload" context parameter to allow the disabling of the non-standard (but useful) behaviour. The parameter's value defaults to "true".
          Hide
          Mircea Toma added a comment -

          Turning off navigation replay by default.

          Show
          Mircea Toma added a comment - Turning off navigation replay by default.
          Hide
          Mircea Toma added a comment -

          Changing ReloadAfterNavigationFix navigation handler to bring navigation behaviour closer to the standard JSF behaviour proved impossible to achieve.
          When non-redirect navigation and redirect navigation rules are mixed it's not possible to determine with certainty if a request is just for page reload or a request for loading a different page.

          For example when page A is loaded and a non-redirect navigation is made to page B all the forms in the rendered page have now page B's url. If we reload page A ReloadAfterNavigationFix navigation handler will make sure the navigation is replayed and B's content is shown again. If we click on a command link with AJAX disabled the requested page is B because the forms use B's url now, so it's impossibile to determine now that what the user really wanted was page A content rendered.

          The compromising solution was to make the replay navigation feature configurable. There are applications or environments (like portals) that use only non-redirect navigation rules. These application become much more natural to use once replay navigation feature is introduced.

          Show
          Mircea Toma added a comment - Changing ReloadAfterNavigationFix navigation handler to bring navigation behaviour closer to the standard JSF behaviour proved impossible to achieve. When non-redirect navigation and redirect navigation rules are mixed it's not possible to determine with certainty if a request is just for page reload or a request for loading a different page. For example when page A is loaded and a non-redirect navigation is made to page B all the forms in the rendered page have now page B's url. If we reload page A ReloadAfterNavigationFix navigation handler will make sure the navigation is replayed and B's content is shown again. If we click on a command link with AJAX disabled the requested page is B because the forms use B's url now, so it's impossibile to determine now that what the user really wanted was page A content rendered. The compromising solution was to make the replay navigation feature configurable. There are applications or environments (like portals) that use only non-redirect navigation rules. These application become much more natural to use once replay navigation feature is introduced.

            People

            • Assignee:
              Mircea Toma
              Reporter:
              Jörg Jansen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: