You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by st...@apache.org on 2010/11/23 23:14:12 UTC

svn commit: r1038361 - /myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandlerfilter.html

Author: struberg
Date: Tue Nov 23 22:14:12 2010
New Revision: 1038361

URL: http://svn.apache.org/viewvc?rev=1038361&view=rev
Log:
EXTCDI-97 introduce ajax windowhandler

Added:
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandlerfilter.html

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandlerfilter.html
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandlerfilter.html?rev=1038361&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandlerfilter.html (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandlerfilter.html Tue Nov 23 22:14:12 2010
@@ -0,0 +1,82 @@
+<!DOCTYPE html
+  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html>
+    <head>
+        <script type="text/javascript" >
+            var http_request;
+
+            function createHttpRequest(){
+                var http_request2;
+                if (window.XMLHttpRequest) { // IE7, Mozilla, Safari,...
+                    http_request2 = new XMLHttpRequest();
+                    if (http_request2.overrideMimeType) {
+                        http_request2.overrideMimeType('text/xml');
+                    }
+                } else if (window.ActiveXObject) { // IE
+                    try {
+                        http_request2 = new ActiveXObject("Msxml2.XMLHTTP");
+                    } catch (e) {
+                        try {
+                            http_request2 = new ActiveXObject("Microsoft.XMLHTTP");
+                        } catch (e) {}
+                    }
+                }
+
+                if (!http_request2) {
+                    alert('Not possible to get HttpRequest object!');
+                    return false;
+                }
+                return http_request2;
+            }
+
+            function doRequest(url){
+                http_request.open('GET', url, true);
+                http_request.onreadystatechange = replaceContent;
+                http_request.send(null);
+            }
+
+            function replaceContent(){
+                if (http_request.readyState == 4) {
+                    if (http_request.status == 200){
+                        if(http_request.responseText!=""){
+                            document.innerHTML=http_request.responseText;
+                            
+                            window.name= http_request.getResponseHeader("myfaces-codi-windowId");
+                        }
+                    }
+                }
+            }
+            var origUrl = window.location.href;
+            if (!window.name || window.name.length < 1) {
+                window.name = 'automatedEntryPoint';
+            }
+
+            var amp = origUrl.contains('?') ? "&" : "?";
+            var newUrl = origUrl + amp + "windowId=" + window.name;
+            http_request = createHttpRequest();
+            doRequest(newUrl);
+        </script>
+    </head>
+<body>
+
+</body>
+</html>
\ No newline at end of file