You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2021/11/29 09:51:03 UTC

[myfaces] branch 2.3.x updated: MYFACES-4423 oam.Flash.REDIRECT should not be set when flash is disabled

This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch 2.3.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/2.3.x by this push:
     new a7d1fc2  MYFACES-4423 oam.Flash.REDIRECT should not be set when flash is disabled
a7d1fc2 is described below

commit a7d1fc23e889f9a0480efc73022db16717909f55
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Mon Nov 29 10:50:56 2021 +0100

    MYFACES-4423 oam.Flash.REDIRECT should not be set when flash is disabled
---
 .../application/viewstate/ServerSideStateCacheImpl.java        |  5 +++--
 .../org/apache/myfaces/shared/context/flash/FlashImpl.java     | 10 ++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java b/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java
index 7ff474e..d596845 100644
--- a/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java
@@ -672,8 +672,9 @@ class ServerSideStateCacheImpl extends StateCache<Object, Object>
     {
         if (_useFlashScopePurgeViewsInSession == null)
         {
-            _useFlashScopePurgeViewsInSession = WebConfigParamUtils.getBooleanInitParameter(
-                    externalContext, USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION, false);
+            _useFlashScopePurgeViewsInSession = !MyfacesConfig.getCurrentInstance(externalContext).isFlashScopeDisabled()
+                    && WebConfigParamUtils.getBooleanInitParameter(externalContext, USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION,
+                            false);
         }
         return _useFlashScopePurgeViewsInSession;
     }
diff --git a/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java b/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
index 363c857..32e1e3c 100644
--- a/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
+++ b/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
@@ -299,6 +299,11 @@ public class FlashImpl extends Flash implements ReleasableFlash
     @Override
     public void setRedirect(boolean redirect)
     {
+        if (_flashScopeDisabled)
+        {
+            return;
+        }
+
         // FIXME this method has a design flaw, because the only valid value
         // is true and it should only be called by the NavigationHandler
         // in a redirect case RIGHT BEFORE ExternalContext.redirect().
@@ -416,6 +421,11 @@ public class FlashImpl extends Flash implements ReleasableFlash
     @Override
     public void setKeepMessages(boolean keepMessages)
     {
+        if (_flashScopeDisabled)
+        {
+            return;
+        }
+
         FacesContext facesContext = FacesContext.getCurrentInstance();
         ExternalContext externalContext = facesContext.getExternalContext();
         Map<String, Object> requestMap = externalContext.getRequestMap();