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

          Jörg Jansen created issue -
          Ken Fyten made changes -
          Field Original Value New Value
          Salesforce Case []
          Fix Version/s 2.1 [ 10241 ]
          Assignee Priority P2
          Assignee Deryk Sinotte [ deryk.sinotte ]
          Deryk Sinotte made changes -
          Assignee Deryk Sinotte [ deryk.sinotte ] Mircea Toma [ mircea.toma ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #25114 Wed Jul 27 07:39:35 MDT 2011 mircea.toma ICE-6927 Introduced ReloadAfterNavigationFix navigation handler to record the triggered navigation. 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.
          Files Changed
          Commit graph ADD /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/application/ReloadAfterNavigationFix.java
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/resources/META-INF/faces-config.xml
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/util/EnvUtils.java
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/application/WindowScopeManager.java
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/event/BridgeSetup.java
          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.
          Mircea Toma made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          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.
          Ken Fyten made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Assignee Priority P2 P1
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #25199 Fri Aug 05 08:12:25 MDT 2011 mircea.toma ICE-6927 Record the navigation that needs to be replayed only for non-redirect navigation cases.
          Files Changed
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/application/ReloadAfterNavigationFix.java
          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.
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          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.
          Greg Dick made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Assignee Priority P1 P2
          Greg Dick made changes -
          Link This issue blocks ICE-7119 [ ICE-7119 ]
          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.
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #25401 Mon Sep 05 08:37:21 MDT 2011 mircea.toma ICE-6927 Introduced "org.icefaces.replayNavigationOnReload" context parameter to allow the disabling of the non-standard behavior.
          Files Changed
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/application/ReloadAfterNavigationFix.java
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/util/EnvUtils.java
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #25402 Mon Sep 05 10:00:42 MDT 2011 mircea.toma ICE-6927 Fix usage of EnvUtils.containsBeans method.
          Files Changed
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/application/WindowScopeManager.java
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #25403 Mon Sep 05 10:06:11 MDT 2011 mircea.toma ICE-6927 Disable navigation replay when session was just restored.
          Files Changed
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/application/ReloadAfterNavigationFix.java
          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".
          Mircea Toma made changes -
          Salesforce Case []
          Affects [Documentation (User Guide, Ref. Guide, etc.)]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #25413 Tue Sep 06 16:09:48 MDT 2011 mircea.toma ICE-6927 Turn off navigation replay by default.
          Files Changed
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/util/EnvUtils.java
          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.
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Fix Version/s 2.1-Beta [ 10291 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: