Details

      Description

      A typical JSF-2 application contains much more GET links than we used to see in JSF-1. Thus we have far more href link to cope with.

      With a classical approach we would not be able to simply add a windowId parameter to such links because if the user would open the link in a new browser window or tab, we would carry the windowId - and thus the window scope - over to the new browser tab/window.
      There is a method to prevent this problem by storing a value directly in the browser window via JavaScript. Usually this is done in the same page and gets executed in the onLoadEvent like described in Marios old Orchestra summary. See "Post render window detection" in http://myfaces.apache.org/orchestra/myfaces-orchestra-core/multiwindow.html
      The major downside of this solution is that we might already pollute 'foreign' beans (and destroy their information) while rendering the page.

      Our new approach now works around this issue by introducing a small static new html window which gets served via a small servlet (Jsf2WindowHandlerServlet). It gets an 'url' and after detecting a new window it will drop the windowId parameter via JavaScript on the client and forwards to the destination page. For creating the destination link I'll override the encodeBookmarkableURL in an ExternalContextWrapper.

      Instead of the original URL: http://localhost:8080/course/courseDetails.xhtml?windowId=1c9f&courseNr=101348&semester=2010W
      we will create a : http://localhost:8080/course/windowhandler?url=%2Fcourse%2FcourseDetails.xhtml%3FwindowId%3D1c9f%26courseNr%3D101348%26semester%3D2010W

      The windowhandler servlet serves a simple html which is cachable (TBD), thus it doesn't lead to duplicated server roundtrips (beside the first time).

        Issue Links

          Activity

          Hide
          Mark Struberg added a comment -

          initial funkctionality committed.

          TODO:
          a.) make the resource path for the windowhandler.html configurable to allow different backgroundcolors and other stuff
          b.) think about caching strategies for the windowhandler.html for high-load scenarios.

          Show
          Mark Struberg added a comment - initial funkctionality committed. TODO: a.) make the resource path for the windowhandler.html configurable to allow different backgroundcolors and other stuff b.) think about caching strategies for the windowhandler.html for high-load scenarios.
          Hide
          Jakob Korherr added a comment -

          What about using window.location.replace() (see [1]) instead of window.location.href in windowhandler.xhtml? This would remove the history-entry of windowhandler.html in the browser!

          [1] http://de.selfhtml.org/javascript/objekte/location.htm#replace

          Show
          Jakob Korherr added a comment - What about using window.location.replace() (see [1] ) instead of window.location.href in windowhandler.xhtml? This would remove the history-entry of windowhandler.html in the browser! [1] http://de.selfhtml.org/javascript/objekte/location.htm#replace
          Hide
          Mark Struberg added a comment -

          that's a very good idea! I think we still need to test/adopt this thingy to make it rock solid - but hope it already does the fundamental things.

          Show
          Mark Struberg added a comment - that's a very good idea! I think we still need to test/adopt this thingy to make it rock solid - but hope it already does the fundamental things.
          Hide
          Jakob Korherr added a comment -

          add JSF12-Module as component.

          Show
          Jakob Korherr added a comment - add JSF12-Module as component.
          Hide
          Jakob Korherr added a comment -

          ClientSideWindowHandler works perfectly if JavaScript is enabled. Furthermore there is a fallback to the default algorithm (request parameter) if JavaScript is disabled.

          Resolving this one!

          Show
          Jakob Korherr added a comment - ClientSideWindowHandler works perfectly if JavaScript is enabled. Furthermore there is a fallback to the default algorithm (request parameter) if JavaScript is disabled. Resolving this one!
          Hide
          Gerhard Petracek added a comment -

          if myfaces-core2 is used this feature needs myfaces-core 2.0.3+

          Show
          Gerhard Petracek added a comment - if myfaces-core2 is used this feature needs myfaces-core 2.0.3+

            People

            • Assignee:
              Unassigned
              Reporter:
              Mark Struberg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development