You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2018/05/08 12:48:15 UTC

[myfaces] 01/01: windowId prototype

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

deki pushed a commit to branch 2.0.8_windowid_prototype
in repository https://gitbox.apache.org/repos/asf/myfaces.git

commit 718ae511f676dfff5554b0c6f719529f63fac5ad
Author: Werner Punz <we...@apache.org>
AuthorDate: Tue Jul 19 10:00:43 2011 +0000

    windowId prototype
---
 .../javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js | 11 +++++++++++
 .../javascript/META-INF/resources/myfaces/_impl/core/Impl.js  |  9 +++++++++
 2 files changed, 20 insertions(+)

diff --git a/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js b/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
index f28d455..af437c6 100644
--- a/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
+++ b/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
@@ -1545,6 +1545,17 @@ myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl._util._Dom", Obj
         }
 
         return this._dummyPlaceHolder;
+    },
+
+    /**
+     * fetches the window id for the current request
+     */
+    getWindowId: function() {
+        var href = window.location.href;
+        var windowId = "windowId";
+        var regex = new RegExp("[\\?&]" + windowId + "=([^&#\\;]*)");
+        var results = regex.exec(href);
+        return (results != null) ? results[1] : null;
     }
 });
 
diff --git a/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js b/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
index 7cc7560..d860dc6 100644
--- a/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
+++ b/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js
@@ -148,6 +148,15 @@ myfaces._impl.core._Runtime.singletonExtendClass("myfaces._impl.core.Impl", Obje
         //options not set we define a default one with nothing
         options = options || {};
 
+        //pass the window id into the options if not set already
+        if(!options.windowId) {
+            var windowId = _Dom.getWindowId();
+            (windowId) ? options["javax.faces.windowId"] = windowId: null;
+        } else {
+            options["javax.faces.windowId"] = options.windowId;
+            delete options.windowId;
+        }
+
         /**
          * we cross reference statically hence the mapping here
          * the entire mapping between the functions is stateless

-- 
To stop receiving notification emails like this one, please contact
deki@apache.org.