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 2019/07/22 10:56:21 UTC

[myfaces] branch master updated: MYFACES-4297

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 5a43c68  MYFACES-4297
5a43c68 is described below

commit 5a43c68afbda087ffe2a7b0ca779cd4062d6939a
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Mon Jul 22 12:56:13 2019 +0200

    MYFACES-4297
---
 .../java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java b/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java
index 2198998..60b273a 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContextImpl.java
@@ -86,7 +86,7 @@ public class ViewScopeContextImpl implements Context
     }
 
     public String getCurrentViewScopeId(boolean create)
-    {
+    {        
         FacesContext facesContext = FacesContext.getCurrentInstance();
         ViewScopeProxyMap map = (ViewScopeProxyMap) facesContext.getViewRoot().getViewMap(create);
         if (map != null)
@@ -148,6 +148,9 @@ public class ViewScopeContextImpl implements Context
     {
         checkActive();
 
+        // force session creation if ViewScoped is used
+        FacesContext.getCurrentInstance().getExternalContext().getSession(true);
+        
         ViewScopeContextualStorage storage = getContextualStorage(false);
         if (storage == null)
         {
@@ -175,6 +178,9 @@ public class ViewScopeContextImpl implements Context
                     " doesn't implement " + PassivationCapable.class.getName());
         }
 
+        // force session creation if ViewScoped is used
+        FacesContext.getCurrentInstance().getExternalContext().getSession(true);
+        
         ViewScopeContextualStorage storage = getContextualStorage(true);
 
         Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();