You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2011/09/01 05:10:27 UTC

[Myfaces Wiki] Update of "Drafts/WindowId" by GerhardPetracek

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The "Drafts/WindowId" page has been changed by GerhardPetracek:
http://wiki.apache.org/myfaces/Drafts/WindowId?action=diff&rev1=12&rev2=13

   8. Client-side window-handler of CODI
      A completely working solution with the drawbacks of page-flickering and the incompatibility with libs like PrettyFaces.
  
+ == Approach of the first prototype ==
+ 
+ detect if it's a valid request before the FacesContext gets created.
+ a valid request is a request with a window-id AND a request-id (the request id is linked to a window-id and not valid with other window-ids)
+ the request-id is stored in a hidden field and gets transferred to a cookie before a request -> it isn't in the url and it isn't shared between tabs.
+ 
+ first request:
+  no window-id (and maybe an old cookie with request-id) -> invalid window -> create a new window -> render small page which sets the cookie with the new request-id and requests the same url again + a window-id
+ 
+ second request:
+  window-id is in the url -> page-refresh is supported because the first request-id is still in the cookie -> state gets rolled back to this old request-id
+  get or post requests -> a js has to executed to transfer the new request-id from the hidden field to the cookie (only in case of the left mouse-button without other keys and keys like the enter key) (hidden field per view-root (not per form)).
+ 
+ ajax requests have to update the hidden field with the request-id in >any< case.
+ 
+ open a new tab and enter the url or open a bookmark -> it's the same like the first request scenario -> done (restriction: creating a bookmark -> opening a new tab and using this bookmark immediately - that will clone the window because the request-id in the cookie is valid for this window-id)
+ 
+ click "open in new tab" via something else than left mouse-button without other keys and keys like the enter key -> remove the cookie (needs to be tested with all browsers)
+ -> new tab gets opened with window-id (from the url) but the cookie was removed -> invalid request -> new window gets created
+ 
+ if all that works, the only constellations which don't work are:
+  * switching to the old tab and refreshing it because the request-id of the old tab has been overridden by the request-id of the new tab -> invalid request -> new window)
+  * creating a bookmark and opening it immediately in a new tab
+ 
  == Misc ==
  
  == Further readings ==