You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2011/02/28 22:51:33 UTC

svn commit: r1075555 - /myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextAwareViewHandler.java

Author: gpetracek
Date: Mon Feb 28 21:51:32 2011
New Revision: 1075555

URL: http://svn.apache.org/viewvc?rev=1075555&view=rev
Log:
EXTCDI-148 calculate the view-id before using it

Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextAwareViewHandler.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextAwareViewHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextAwareViewHandler.java?rev=1075555&r1=1075554&r2=1075555&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextAwareViewHandler.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextAwareViewHandler.java Mon Feb 28 21:51:32 2011
@@ -106,13 +106,30 @@ public class WindowContextAwareViewHandl
             if(windowContext != null)
             {
                 //see EXTCDI-131
-                storeViewIdAsNewViewId(windowContext, viewId);
+                storeViewIdAsNewViewId(windowContext, calculateViewId(facesContext, viewId));
             }
         }
 
         return super.restoreView(facesContext, viewId);
     }
 
+    //see EXTCDI-148 required if the mapped url is different from the final view-id
+    private String calculateViewId(FacesContext facesContext, String viewId)
+    {
+        UIViewRoot uiViewRoot = this.wrapped.createView(facesContext, viewId);
+
+        if(uiViewRoot != null)
+        {
+            String newViewId = uiViewRoot.getViewId();
+
+            if(newViewId != null)
+            {
+                return newViewId;
+            }
+        }
+        return viewId;
+    }
+
     /**
      * check if the window-id has been restored before the restore-view phase
      * @param facesContext current faces-context