myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r992516 - /myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/ConversationUtils.java
Date Sat, 04 Sep 2010 00:42:08 GMT
Author: gpetracek
Date: Sat Sep  4 00:42:07 2010
New Revision: 992516

URL: http://svn.apache.org/viewvc?rev=992516&view=rev
Log:
EXTCDI-48

Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/ConversationUtils.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/ConversationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/ConversationUtils.java?rev=992516&r1=992515&r2=992516&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/ConversationUtils.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/ConversationUtils.java
Sat Sep  4 00:42:07 2010
@@ -65,6 +65,8 @@ public class ConversationUtils
     private static final String OLD_VIEW_ID_KEY = "oldViewId";
     private static final String NEW_VIEW_ID_KEY = "newViewId";
 
+    private static final String REDIRECT_PERFORMED_KEY = WindowHandler.class.getName() +
"redirect:KEY";
+
     /**
      * @return the descriptor of a custom
      * {@link org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager}
@@ -344,6 +346,15 @@ public class ConversationUtils
                                     String url,
                                     WindowHandler windowHandler) throws IOException
     {
+        if(isMultipleRedirectDetected(externalContext))
+        {
+            return;
+        }
+        else
+        {
+            redirectPerformed(externalContext);
+        }
+
         storeCurrentViewIdAsOldViewId(FacesContext.getCurrentInstance());
 
         RequestCache.resetCache();
@@ -359,6 +370,16 @@ public class ConversationUtils
         }
     }
 
+    private static boolean isMultipleRedirectDetected(ExternalContext externalContext)
+    {
+        return externalContext.getRequestMap().containsKey(REDIRECT_PERFORMED_KEY);
+    }
+
+    private static void redirectPerformed(ExternalContext externalContext)
+    {
+        externalContext.getRequestMap().put(REDIRECT_PERFORMED_KEY, Boolean.TRUE);
+    }
+
     public static JsfAwareWindowContextConfig getJsfAwareWindowContextConfig()
     {
         Set<Bean<?>> configResolvers = getInstance().getBeanManager().getBeans(ConfigResolver.class);



Mime
View raw message