Uploaded image for project: 'MyFaces CODI'
  1. MyFaces CODI
  2. EXTCDI-79

introduce client side windowhandler

    XMLWordPrintableJSON

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).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              struberg Mark Struberg
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: