You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by ta...@apache.org on 2016/05/17 16:36:26 UTC

deltaspike git commit: DELTASPIKE-1144 added more log statemenets

Repository: deltaspike
Updated Branches:
  refs/heads/master 8659d998e -> 138eec616


DELTASPIKE-1144 added more log statemenets

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

Branch: refs/heads/master
Commit: 138eec6167cf7cfa428d3dab78a7b870eb72920d
Parents: 8659d99
Author: tandraschko <ta...@apache.org>
Authored: Tue May 17 18:35:55 2016 +0200
Committer: tandraschko <ta...@apache.org>
Committed: Tue May 17 18:35:55 2016 +0200

----------------------------------------------------------------------
 .../component/window/WindowIdHtmlRenderer.java  | 12 +++---
 .../resources/deltaspike/windowhandler.js       | 40 +++++++++++++-------
 2 files changed, 34 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/138eec61/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 b703639..755f0c6 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
@@ -42,7 +42,7 @@ public class WindowIdHtmlRenderer extends Renderer
 {
     private volatile ClientWindow clientWindow;
     private volatile ClientWindowConfig clientWindowConfig;
-    private int maxWindowIdCount = 10;
+    private int maxWindowIdLength = 10;
 
     /**
      * 'deltaspikeJsWindowId' will be used to:
@@ -77,7 +77,9 @@ public class WindowIdHtmlRenderer extends Renderer
         ResponseWriter writer = context.getResponseWriter();
         writer.write("<script type=\"text/javascript\">");
         writer.write("(function(){");
-        writer.write("dswh.init('" + windowId + "','" + clientWindowRenderMode.name() + "',{");
+        writer.write("dswh.init('" + windowId + "','"
+                + clientWindowRenderMode.name() + "',"
+                + maxWindowIdLength + ",{");
 
         writer.write("'tokenizedRedirect':" + clientWindowConfig.isClientWindowTokenizedRedirectEnabled());
         writer.write(",'storeWindowTreeOnLinkClick':"
@@ -107,9 +109,9 @@ public class WindowIdHtmlRenderer extends Renderer
     protected String secureWindowId(String windowId)
     {
         //restrict the length to prevent script-injection
-        if (windowId != null && windowId.length() > this.maxWindowIdCount)
+        if (windowId != null && windowId.length() > this.maxWindowIdLength)
         {
-            windowId = windowId.substring(0, this.maxWindowIdCount);
+            windowId = windowId.substring(0, this.maxWindowIdLength);
         }
         return windowId;
     }
@@ -124,7 +126,7 @@ public class WindowIdHtmlRenderer extends Renderer
                 {
                     clientWindowConfig = BeanProvider.getContextualReference(ClientWindowConfig.class);
                     clientWindow = BeanProvider.getContextualReference(ClientWindow.class);
-                    maxWindowIdCount = ClientWindowHelper.getMaxWindowIdLength();
+                    maxWindowIdLength = ClientWindowHelper.getMaxWindowIdLength();
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/138eec61/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
index bf24141..2805b9e 100644
--- a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
+++ b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
@@ -22,11 +22,20 @@ window.dswh = window.dswh || {
 
     windowId : null,
     clientWindowRenderMode : null,
-    cfg: null,
+    maxWindowIdLength : 10,
+    cfg : null,
+
+    init : function(windowId, clientWindowRenderMode, maxWindowIdLength, cfg) {
+
+        if (dswh.DEBUG_MODE === true) {
+            console.log('---- DeltaSpike WindowHandler ----');
+            console.log('#init(\'' + windowId + '\', \'' + clientWindowRenderMode + '\',' + maxWindowIdLength + ',' + dswh.utils.stringify(cfg) + ')');
+            console.log('window.name: ' + window.name);
+        }
 
-    init : function(windowId, clientWindowRenderMode, cfg) {
         this.windowId = windowId;
         this.clientWindowRenderMode = clientWindowRenderMode;
+        this.maxWindowIdLength = maxWindowIdLength;
         if (cfg) {
             this.cfg = cfg;
         } else {
@@ -35,16 +44,26 @@ window.dswh = window.dswh || {
 
         var targetStrategy = this.strategy[clientWindowRenderMode];
         if (targetStrategy) {
+            if (dswh.DEBUG_MODE === true) {
+                console.log(clientWindowRenderMode + ' #validate');
+            }
+
             targetStrategy.validate();
 
             // early init
             // this is required if e.g. the onload attr is defined on the body tag and our onload handler won't be called
             // ATTENTION: the ds:windowId component must be placed as last body tag
+            if (dswh.DEBUG_MODE === true) {
+                console.log(clientWindowRenderMode + ' #init(false)');
+            }
             targetStrategy.init(false);
 
             // JSF ajax callback
             jsf.ajax.addOnEvent(function(event) {
                 if (event.status === "success") {
+                    if (dswh.DEBUG_MODE === true) {
+                        console.log(clientWindowRenderMode + ' #init(true)');
+                    }
                     targetStrategy.init(true);
                 }
             });
@@ -52,6 +71,9 @@ window.dswh = window.dswh || {
             // PF ajax callback
             if (window.$ && window.PrimeFaces) {
                 $(document).on('pfAjaxComplete', function () {
+                    if (dswh.DEBUG_MODE === true) {
+                        console.log(clientWindowRenderMode + ' #init(true)');
+                    }
                     targetStrategy.init(true);
                 });
             }
@@ -63,6 +85,9 @@ window.dswh = window.dswh || {
                 try {
                     (oldWindowOnLoad) ? oldWindowOnLoad(evt) : null;
                 } finally {
+                    if (dswh.DEBUG_MODE === true) {
+                        console.log(clientWindowRenderMode + ' #init(false)');
+                    }
                     targetStrategy.init(false);
                 }
             };
@@ -274,25 +299,14 @@ window.dswh = window.dswh || {
             },
 
             init : function(ajax) {
-                if (dswh.DEBUG_MODE === true) {
-                    console.log('LAZY#init');
-                }
-
                 dswh.utils.appendHiddenWindowIdToForms();
             },
 
             assertWindowId : function() {
-                if (dswh.DEBUG_MODE === true) {
-                    console.log('LAZY#assertWindowId');
-                }
-
                 var dswid = dswh.utils.getUrlParameter(window.location.href, 'dswid');
 
                 if (dswh.DEBUG_MODE === true) {
-                    console.log('window.name: ' + window.name);
                     console.log('dswid: ' + dswid);
-                    console.log('windowId: ' + dswh.windowId);
-                    console.log('initialRedirectWindowId: ' + dswh.cfg.initialRedirectWindowId);
                 }
 
                 // window.name is null which means that "open in new tab/window" was used