You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2013/12/19 18:17:08 UTC

svn commit: r1552360 - in /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax: AjaxNavigationListener.java AjaxNavigationState.java

Author: weber
Date: Thu Dec 19 17:17:08 2013
New Revision: 1552360

URL: http://svn.apache.org/r1552360
Log:
TOBAGO-1348 - Locale lost after navigation in partiall response

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationListener.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationState.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationListener.java?rev=1552360&r1=1552359&r2=1552360&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationListener.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationListener.java Thu Dec 19 17:17:08 2013
@@ -27,18 +27,16 @@ public class AjaxNavigationListener impl
 
   public void afterPhase(final PhaseEvent phaseEvent) {
     if (phaseEvent.getPhaseId() == PhaseId.RESTORE_VIEW) {
-      AjaxNavigationState.storeIncomingView(phaseEvent.getFacesContext());
+      AjaxNavigationState.afterRestoreView(phaseEvent.getFacesContext());
     }
   }
 
   public void beforePhase(final PhaseEvent phaseEvent) {
-    if (phaseEvent.getPhaseId() == PhaseId.RESTORE_VIEW) {
-      AjaxNavigationState.handleNavigation(phaseEvent.getFacesContext());
-    }
+    AjaxNavigationState.beforeRestoreView(phaseEvent.getFacesContext());
   }
 
   public PhaseId getPhaseId() {
-    return PhaseId.ANY_PHASE;
+    return PhaseId.RESTORE_VIEW;
   }
   
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationState.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationState.java?rev=1552360&r1=1552359&r2=1552360&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationState.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxNavigationState.java Thu Dec 19 17:17:08 2013
@@ -136,13 +136,24 @@ public final class AjaxNavigationState {
     return false;
   }
 
-  public static void handleNavigation(final FacesContext facesContext) {
+  public static void afterRestoreView(final FacesContext facesContext) {
     final Map<String, Object> sessionMap = facesContext.getExternalContext().getSessionMap();
     final AjaxNavigationState navigationState
         = (AjaxNavigationState) sessionMap.remove(AjaxNavigationState.SESSION_KEY);
-    if (navigationState != null) {
+    if (navigationState == null) {
+      storeIncomingView(facesContext);
+    } else {
       navigationState.restoreView(facesContext);
       LOG.trace("force render requested navigation view");
     }
   }
+
+  public static void beforeRestoreView(FacesContext facesContext) {
+    final Map<String, Object> sessionMap = facesContext.getExternalContext().getSessionMap();
+    if (sessionMap.get(AjaxNavigationState.SESSION_KEY) != null) {
+      // set empty UIViewRoot to prevent executing restore state logic
+      facesContext.setViewRoot(new UIViewRoot());
+    }
+
+  }
 }