deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject deltaspike git commit: DELTASPIKE-959 DS cuts the windowId generated from JSF 2.2
Date Thu, 16 Jul 2015 09:01:10 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master c9529a54f -> 938e6ecb3


DELTASPIKE-959 DS cuts the windowId generated from JSF 2.2

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

Branch: refs/heads/master
Commit: 938e6ecb307af8973b0d44c0c0cb6c4435c37a38
Parents: c9529a5
Author: tandraschko <tandraschko@apache.org>
Authored: Thu Jul 16 11:01:02 2015 +0200
Committer: tandraschko <tandraschko@apache.org>
Committed: Thu Jul 16 11:01:02 2015 +0200

----------------------------------------------------------------------
 .../jsf/api/config/JsfModuleConfig.java         | 17 +++++-----------
 .../component/window/WindowIdHtmlRenderer.java  | 21 ++++++++++++--------
 .../strategy/AbstractClientWindowStrategy.java  | 14 +++++++++----
 3 files changed, 28 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/938e6ecb/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 92972de..181a00d 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
@@ -126,7 +126,7 @@ public class JsfModuleConfig implements DeltaSpikeConfig
      * Defines the {@link javax.enterprise.Qualifier} which will be used to fire the
      * {@link org.apache.deltaspike.core.api.exception.control.event.ExceptionToCatchEvent}
      * for unhandled JSF exceptions.
-     * 
+     *
      * @return the {@link javax.enterprise.Qualifier}.
      */
     public Class<? extends Annotation> getExceptionQualifier()
@@ -142,17 +142,10 @@ public class JsfModuleConfig implements DeltaSpikeConfig
     public boolean isJsf22Available()
     {
         lazyInit();
-        
+
         return this.jsf22Available;
     }
-    
-    public boolean isDelegatedWindowHandlingEnabled()
-    {
-        lazyInit();
-        
-        return this.delegatedWindowHandlingEnabled;
-    }
-    
+
     private void lazyInit()
     {
         if (this.initialized == null)
@@ -182,13 +175,13 @@ public class JsfModuleConfig implements DeltaSpikeConfig
                 }
                 else
                 {
-                    
+
                     String initParam = facesContext.getExternalContext().getInitParameter(CLIENT_WINDOW_CONFIG_KEY);
                     this.delegatedWindowHandlingEnabled =
                             !(initParam == null || "none".equalsIgnoreCase(initParam.trim()));
                 }
             }
-            
+
             this.initialized = true;
         }
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/938e6ecb/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
index 7db4de4..7cd2e03 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
@@ -60,24 +60,29 @@ public class WindowIdHtmlRenderer extends Renderer
         lazyInit();
 
         String windowId = clientWindow.getWindowId(context);
-        String clientWindowRenderMode = clientWindowConfig.getClientWindowRenderMode(context).name();
+        ClientWindowConfig.ClientWindowRenderMode clientWindowRenderMode =
+                clientWindowConfig.getClientWindowRenderMode(context);
 
-        //already ensured by DefaultClientWindow
-        //just to ensure that we don't get a security issue in case of a customized client-window
implementation
-        //will never happen usually -> no real overhead
-        if (windowId != null && windowId.length() > this.maxWindowIdCount)
+        // don't cut the windowId generated from JSF
+        if (!ClientWindowConfig.ClientWindowRenderMode.DELEGATED.equals(clientWindowRenderMode))
         {
-            windowId = windowId.substring(0, this.maxWindowIdCount);
+            //already ensured by DefaultClientWindow
+            //just to ensure that we don't get a security issue in case of a customized client-window
implementation
+            //will never happen usually -> no real overhead
+            if (windowId != null && windowId.length() > this.maxWindowIdCount)
+            {
+                windowId = windowId.substring(0, this.maxWindowIdCount);
+            }
         }
 
         ResponseWriter writer = context.getResponseWriter();
         writer.startElement("script", component);
         writer.writeAttribute("type", "text/javascript", null);
         writer.write("(function(){");
-        writer.write("dswh.init('" + windowId + "','" + clientWindowRenderMode + "',{");
+        writer.write("dswh.init('" + windowId + "','" + clientWindowRenderMode.name() + "',{");
 
         writer.write("'storeWindowTree':'" + clientWindowConfig.isClientWindowStoreWindowTreeEnabled()
+ "'");
-        
+
         // see #729
         if (clientWindow.isInitialRedirectSupported(context))
         {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/938e6ecb/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/strategy/AbstractClientWindowStrategy.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/strategy/AbstractClientWindowStrategy.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/strategy/AbstractClientWindowStrategy.java
index af956a2..ea70794 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/strategy/AbstractClientWindowStrategy.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/strategy/AbstractClientWindowStrategy.java
@@ -79,9 +79,15 @@ public abstract class AbstractClientWindowStrategy implements ClientWindow
 
         if (windowId != null)
         {
-            if (windowId.length() > this.maxWindowIdCount)
+            // don't cut the windowId generated from JSF
+            ClientWindowConfig.ClientWindowRenderMode clientWindowRenderMode =
+                    clientWindowConfig.getClientWindowRenderMode(facesContext);
+            if (!ClientWindowConfig.ClientWindowRenderMode.DELEGATED.equals(clientWindowRenderMode))
             {
-                windowId = windowId.substring(0, this.maxWindowIdCount);
+                if (windowId.length() > this.maxWindowIdCount)
+                {
+                    windowId = windowId.substring(0, this.maxWindowIdCount);
+                }
             }
 
             requestMap.put(CACHE_WINDOW_ID, windowId);
@@ -135,7 +141,7 @@ public abstract class AbstractClientWindowStrategy implements ClientWindow
         Map<String, String> requestParameters = facesContext.getExternalContext().getRequestParameterMap();
         return requestParameters.get(ClientWindowHelper.RequestParameters.GET_WINDOW_ID);
     }
-    
+
     @Override
     public void disableClientWindowRenderMode(FacesContext facesContext)
     {
@@ -178,7 +184,7 @@ public abstract class AbstractClientWindowStrategy implements ClientWindow
     {
         return false;
     }
-    
+
     @Override
     public Map<String, String> getQueryURLParameters(FacesContext facesContext)
     {


Mime
View raw message