deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject [1/3] git commit: DELTASPIKE-504 JsfModuleConfig#getDefaultWindowMode
Date Mon, 20 Jan 2014 09:06:03 GMT
Updated Branches:
  refs/heads/master c6867450a -> 1bd08a2c7


DELTASPIKE-504 JsfModuleConfig#getDefaultWindowMode


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/ce7c9f94
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/ce7c9f94
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/ce7c9f94

Branch: refs/heads/master
Commit: ce7c9f94bd0e210834c097b486484fd4a3fd481a
Parents: c686745
Author: gpetracek <gpetracek@apache.org>
Authored: Mon Jan 20 09:55:18 2014 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Mon Jan 20 09:55:18 2014 +0100

----------------------------------------------------------------------
 .../jsf/api/config/JsfModuleConfig.java          | 19 ++++++++++++++++++-
 .../scope/window/DefaultClientWindowConfig.java  | 13 ++++++-------
 .../JsfClientWindowAwareLifecycleWrapper.java    |  5 +++--
 3 files changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ce7c9f94/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/JsfModuleConfig.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/JsfModuleConfig.java
b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/JsfModuleConfig.java
index ee2c0a6..dff9398 100644
--- a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/JsfModuleConfig.java
+++ b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/JsfModuleConfig.java
@@ -20,6 +20,7 @@ package org.apache.deltaspike.jsf.api.config;
 
 import org.apache.deltaspike.core.api.config.DeltaSpikeConfig;
 import org.apache.deltaspike.core.util.ClassUtils;
+import org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.faces.context.FacesContext;
@@ -87,7 +88,23 @@ public class JsfModuleConfig implements DeltaSpikeConfig
         return true;
     }
 
-    public boolean isDelegatedWindowHandlingEnabled()
+    /**
+     * If the window-handling of JSF 2.2+ is enabled,
+     * {@link org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig.ClientWindowRenderMode#DELEGATED}
+     * will be returned. In all other cases <code>null</code> gets returned as
application wide default value.
+     * That leads to a default-handling per session (which includes logic for handling bots,...)
+     * @return application-default for the window-mode
+     */
+    public ClientWindowConfig.ClientWindowRenderMode getDefaultWindowMode()
+    {
+        if (isDelegatedWindowHandlingEnabled())
+        {
+            return ClientWindowConfig.ClientWindowRenderMode.DELEGATED;
+        }
+        return null;
+    }
+
+    protected boolean isDelegatedWindowHandlingEnabled()
     {
         if (ClassUtils.tryToLoadClassForName(CLIENT_WINDOW_CLASS_NAME) == null)
         {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ce7c9f94/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
index b2cb37d..9978b77 100644
--- a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
+++ b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/spi/scope/window/DefaultClientWindowConfig.java
@@ -74,12 +74,12 @@ public class DefaultClientWindowConfig implements ClientWindowConfig,
Serializab
     @Inject
     private ProjectStage projectStage;
 
-    private boolean useDelegatedWindowHandling;
+    private ClientWindowRenderMode defaultClientWindowRenderMode;
 
     @PostConstruct
     protected void init()
     {
-        this.useDelegatedWindowHandling = this.jsfModuleConfig.isDelegatedWindowHandlingEnabled();
+        this.defaultClientWindowRenderMode = this.jsfModuleConfig.getDefaultWindowMode();
     }
 
     @Override
@@ -131,9 +131,9 @@ public class DefaultClientWindowConfig implements ClientWindowConfig,
Serializab
     {
         if (!isJavaScriptEnabled())
         {
-            if (this.useDelegatedWindowHandling)
+            if (this.defaultClientWindowRenderMode != null)
             {
-                return ClientWindowRenderMode.DELEGATED;
+                return this.defaultClientWindowRenderMode;
             }
             return ClientWindowRenderMode.NONE;
         }
@@ -150,11 +150,10 @@ public class DefaultClientWindowConfig implements ClientWindowConfig,
Serializab
             return ClientWindowRenderMode.NONE;
         }
 
-        if (this.useDelegatedWindowHandling)
+        if (this.defaultClientWindowRenderMode != null)
         {
-            return ClientWindowRenderMode.DELEGATED;
+            return this.defaultClientWindowRenderMode;
         }
-
         return ClientWindowRenderMode.CLIENTWINDOW;
     }
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ce7c9f94/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
index 13c66a1..4097596 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
@@ -23,6 +23,7 @@ import org.apache.deltaspike.core.util.ExceptionUtils;
 import org.apache.deltaspike.jsf.api.config.JsfModuleConfig;
 import org.apache.deltaspike.jsf.impl.scope.window.ClientWindowAdapter;
 import org.apache.deltaspike.jsf.spi.scope.window.ClientWindow;
+import org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig;
 
 import javax.faces.context.FacesContext;
 import javax.faces.lifecycle.Lifecycle;
@@ -152,8 +153,8 @@ public class JsfClientWindowAwareLifecycleWrapper extends LifecycleWrapper
         // switch into paranoia mode
         if (initialized == null)
         {
-            delegateWindowHandling =
-                BeanProvider.getContextualReference(JsfModuleConfig.class).isDelegatedWindowHandlingEnabled();
+            delegateWindowHandling = ClientWindowConfig.ClientWindowRenderMode.DELEGATED.equals(
+                BeanProvider.getContextualReference(JsfModuleConfig.class).getDefaultWindowMode());
 
             initialized = true;
         }


Mime
View raw message