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/18 22:53:58 UTC

svn commit: r1036649 - in /myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl: ./ src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/config/ src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/ src/main/java/org/...

Author: struberg
Date: Thu Nov 18 21:53:57 2010
New Revision: 1036649

URL: http://svn.apache.org/viewvc?rev=1036649&view=rev
Log:
EXTCDI-79 introduce client side WindowHandler logic

This will rewrite all bookmarkable urls to lead to a 
small javascript page which decides if we are in a 
new browser tab. If so, it will drop the windowId
parameter from the destination URL.

Added:
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/Jsf2WindowHandler.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/spi/
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/spi/Jsf2ModuleConfig.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/Jsf2WindowHandlerServlet.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowUser.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html
Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/pom.xml
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/config/DefaultWindowContextConfig.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/RedirectedConversationAwareExternalContext.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/ServerSideWindowHandler.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/pom.xml?rev=1036649&r1=1036648&r2=1036649&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/pom.xml Thu Nov 18 21:53:57 2010
@@ -64,6 +64,13 @@
             <artifactId>geronimo-interceptor_1.1_spec</artifactId>
             <scope>provided</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
     </dependencies>
 
     <build>

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/config/DefaultWindowContextConfig.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/config/DefaultWindowContextConfig.java?rev=1036649&r1=1036648&r2=1036649&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/config/DefaultWindowContextConfig.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/config/DefaultWindowContextConfig.java Thu Nov 18 21:53:57 2010
@@ -18,29 +18,21 @@
  */
 package org.apache.myfaces.extensions.cdi.jsf2.impl.config;
 
+import org.apache.myfaces.extensions.cdi.jsf2.impl.scope.conversation.spi.Jsf2ModuleConfig;
+
+
 /**
  * @author Gerhard Petracek
  */
 @SuppressWarnings({"UnusedDeclaration"})
-public class DefaultWindowContextConfig extends
-        org.apache.myfaces.extensions.cdi.jsf.impl.config.DefaultWindowContextConfig
+public class DefaultWindowContextConfig
+        extends org.apache.myfaces.extensions.cdi.jsf.impl.config.DefaultWindowContextConfig
+        implements Jsf2ModuleConfig
 {
     private static final long serialVersionUID = 5184658265260290647L;
 
-    /*
-    @Override
-    public boolean isInitialRedirectDisable()
+    public boolean isClientSideWindowHandler()
     {
         return true;
     }
-
-    @Override
-    public Jsf2WindowHandlerServlet getWindowHandler()
-    {
-        return new ServerSideWindowHandler(isUrlParameterSupported())
-        {
-            private static final long serialVersionUID = -9034142203391043297L;
-        };
-    }
-    */
 }

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/Jsf2WindowHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/Jsf2WindowHandler.java?rev=1036649&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/Jsf2WindowHandler.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/Jsf2WindowHandler.java Thu Nov 18 21:53:57 2010
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.extensions.cdi.jsf2.impl.scope.conversation;
+
+import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.DefaultWindowHandler;
+import org.apache.myfaces.extensions.cdi.jsf2.impl.scope.conversation.spi.Jsf2ModuleConfig;
+import org.apache.myfaces.extensions.cdi.jsf2.impl.windowhandler.Jsf2WindowHandlerServlet;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Specializes;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
+import javax.inject.Inject;
+import java.io.IOException;
+
+/**
+ * WindowHandler with JSF2 features
+ */
+@ApplicationScoped
+@Specializes
+public class Jsf2WindowHandler extends DefaultWindowHandler
+{
+    boolean isClientSideWindowHandler;
+
+    protected Jsf2WindowHandler()
+    {
+        // default ct is needed for proxying 
+    }
+
+    @Inject
+    protected Jsf2WindowHandler(Jsf2ModuleConfig config)
+    {
+        super(config);
+        this.isClientSideWindowHandler = config.isClientSideWindowHandler();
+    }
+
+    @Override
+    public void sendRedirect(ExternalContext externalContext, String url, boolean addRequestParameter)
+    throws IOException
+    {
+        PartialViewContext pvc = FacesContext.getCurrentInstance().getPartialViewContext();
+        if (pvc != null && pvc.isPartialRequest())
+        {
+            super.sendRedirect(externalContext, url, addRequestParameter);
+            return;
+        }
+
+         if (url != null && url.startsWith(Jsf2WindowHandlerServlet.WINDOWHANDLER_URL))
+         {
+             externalContext.redirect(url);
+             return;
+         }
+
+        super.sendRedirect(externalContext, url, addRequestParameter);
+    }
+}

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/RedirectedConversationAwareExternalContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/RedirectedConversationAwareExternalContext.java?rev=1036649&r1=1036648&r2=1036649&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/RedirectedConversationAwareExternalContext.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/RedirectedConversationAwareExternalContext.java Thu Nov 18 21:53:57 2010
@@ -22,11 +22,16 @@ import static org.apache.myfaces.extensi
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.WindowHandler;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.JsfModuleConfig;
 import org.apache.myfaces.extensions.cdi.core.impl.util.CodiUtils;
+import org.apache.myfaces.extensions.cdi.jsf2.impl.windowhandler.Jsf2WindowHandlerServlet;
 
 import javax.faces.context.ExternalContext;
 import javax.faces.context.ExternalContextWrapper;
 import java.io.IOException;
-             
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @author Gerhard Petracek
  */
@@ -68,6 +73,17 @@ public class RedirectedConversationAware
         return this.wrapped.encodeActionURL(s);
     }
 
+
+    @Override
+    public String encodeBookmarkableURL(String baseUrl, Map<String, List<String>> parameters)
+    {
+        Map<String, List<String>> newparms = new HashMap<String, List<String>>();
+        List<String> urlParam= new ArrayList<String>();
+        urlParam.add(wrapped.encodeBookmarkableURL(baseUrl, parameters));
+        newparms.put(Jsf2WindowHandlerServlet.URL_PARAM, urlParam);
+        return wrapped.encodeBookmarkableURL(Jsf2WindowHandlerServlet.WINDOWHANDLER_URL, newparms);
+    }
+
     private synchronized void lazyInit()
     {
         if(this.windowHandler == null)

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/ServerSideWindowHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/ServerSideWindowHandler.java?rev=1036649&r1=1036648&r2=1036649&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/ServerSideWindowHandler.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/ServerSideWindowHandler.java Thu Nov 18 21:53:57 2010
@@ -18,16 +18,16 @@
  */
 package org.apache.myfaces.extensions.cdi.jsf2.impl.scope.conversation;
 
-import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.DefaultWindowHandler;
-import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.JsfModuleConfig;
+import org.apache.myfaces.extensions.cdi.jsf2.impl.scope.conversation.spi.Jsf2ModuleConfig;
 
 import static org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils.tryToLoadClassForName;
 import static org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager
         .WINDOW_CONTEXT_ID_PARAMETER_KEY;
 
+import javax.enterprise.inject.Alternative;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
-import javax.enterprise.inject.Typed;
+import javax.inject.Inject;
 import java.io.IOException;
 
 /**
@@ -36,16 +36,17 @@ import java.io.IOException;
  *
  * @author Gerhard Petracek
  */
-@Typed()
 @SuppressWarnings({"UnusedDeclaration"})
-public abstract class ServerSideWindowHandler extends DefaultWindowHandler
+@Alternative
+public abstract class ServerSideWindowHandler extends Jsf2WindowHandler
 {
     private static final long serialVersionUID = 4040116087475343221L;
 
     //workaround for mojarra
     private final boolean useFallback;
 
-    protected ServerSideWindowHandler(JsfModuleConfig config)
+    @Inject
+    protected ServerSideWindowHandler(Jsf2ModuleConfig config)
     {
         super(config);
         this.useFallback = tryToLoadClassForName("org.apache.myfaces.context.FacesContextFactoryImpl") == null;

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/spi/Jsf2ModuleConfig.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/spi/Jsf2ModuleConfig.java?rev=1036649&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/spi/Jsf2ModuleConfig.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/spi/Jsf2ModuleConfig.java Thu Nov 18 21:53:57 2010
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.extensions.cdi.jsf2.impl.scope.conversation.spi;
+
+import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.JsfModuleConfig;
+
+/**
+ * JSF2 specific configuration
+ */
+public interface Jsf2ModuleConfig extends JsfModuleConfig
+{
+    boolean isClientSideWindowHandler();
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/Jsf2WindowHandlerServlet.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/Jsf2WindowHandlerServlet.java?rev=1036649&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/Jsf2WindowHandlerServlet.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/Jsf2WindowHandlerServlet.java Thu Nov 18 21:53:57 2010
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.extensions.cdi.jsf2.impl.windowhandler;
+
+import org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider;
+import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URLDecoder;
+import java.util.Set;
+
+/**
+ * Serves the windowhandler.html from the resource path
+ */
+@WebServlet(urlPatterns={Jsf2WindowHandlerServlet.WINDOWHANDLER_URL})
+public class Jsf2WindowHandlerServlet extends HttpServlet
+{
+    public final static String URL_PARAM = "url";
+    public final static String WINDOWHANDLER_URL = "windowhandler";
+
+    private WindowUser windowUser;
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+    throws ServletException, IOException
+    {
+        if (!isJavaScriptEnabled())
+        {
+            String url = req.getParameter(URL_PARAM);
+            if (url == null)
+            {
+                throw new ServletException("could not find url parameter!");
+            }
+            url = URLDecoder.decode(url, "UTF-8");
+            resp.sendRedirect(url);
+            return;
+        }
+
+        sendWindowHandler(req, resp);
+    }
+
+    private void sendWindowHandler(HttpServletRequest req, HttpServletResponse resp)
+    throws ServletException, IOException
+    {
+        resp.setStatus(HttpServletResponse.SC_OK);
+        resp.setContentType("text/html");
+
+        InputStream is = ClassUtils.getClassLoader(null).getResourceAsStream("static/windowhandler.html");
+        OutputStream os = resp.getOutputStream();
+        try
+        {
+            byte[] buf = new byte[16*4096];
+            int bytesRead;
+            while ((bytesRead = is.read(buf)) != -1)
+            {
+                os.write(buf, 0, bytesRead);
+            }
+        }
+        finally 
+        {
+            is.close();
+            os.close();
+        }
+    }
+
+    private boolean isJavaScriptEnabled()
+    {
+        if (windowUser == null)
+        {
+            BeanManager bm = BeanManagerProvider.getInstance().getBeanManager();
+            Set<Bean<?>> beans = bm.getBeans(WindowUser.class);
+            Bean<?> wuBean = bm.resolve(beans);
+            CreationalContext<?> cc = bm.createCreationalContext(wuBean);
+            windowUser = (WindowUser) bm.getReference(wuBean, WindowUser.class, cc);
+        }
+
+        return windowUser.isJavaScriptEnabled();
+    }
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowUser.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowUser.java?rev=1036649&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowUser.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/windowhandler/WindowUser.java Thu Nov 18 21:53:57 2010
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.extensions.cdi.jsf2.impl.windowhandler;
+
+import javax.enterprise.context.SessionScoped;
+import java.io.Serializable;
+
+/**
+ * Contains information about whether the user has
+ * JavaScript enabled on his client, etc.
+ */
+@SessionScoped
+public class WindowUser implements Serializable
+{
+
+    boolean javaScriptEnabled = true;
+
+
+    public boolean isJavaScriptEnabled()
+    {
+        return javaScriptEnabled;
+    }
+
+    public void setJavaScriptEnabled(boolean javaScriptEnabled)
+    {
+        this.javaScriptEnabled = javaScriptEnabled;
+    }
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html?rev=1036649&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/static/windowhandler.html Thu Nov 18 21:53:57 2010
@@ -0,0 +1,81 @@
+<html>
+    <head>
+<script type="text/javascript" >
+    function getQueryVariable(query, variable) {
+        var vars = query.split("&amp;");
+        for (var i=0; vars != null && i < vars.length; i++) {
+          var pair = vars[i].split("=");
+          if (pair[0] == variable) {
+              return pair[1];
+          }
+        }
+        return "";
+    }
+
+    function fixWindowId(query) {
+        var vars = query.split(/&|\?/g);
+        var newQuery = "";
+        var iParam = 0;
+
+        var freshWindow = window.name.length < 1;
+        var windowIdFound = false;
+
+        for (var i=0; vars != null && i < vars.length; i++) {
+            var pair = vars[i].split("=");
+            if (pair.length == 1) {
+                newQuery = pair[0];
+            }
+            else {
+                if (pair[0] == "windowId") {
+                    windowIdFound = true;
+                    if (freshWindow) {
+                        window.name = 'xxx';
+                    }
+                    else {
+                        // correct the windowId
+                        if (window.name == 'xxx'){
+                            window.name = pair[1];
+                        }
+
+                        var amp = iParam++ > 0 ? "&" : "?";
+                        newQuery =  newQuery + amp + "windowId=" + pair[1];
+                    }
+                }
+                else {
+                    var amp = iParam++ > 0 ? "&" : "?";
+                    newQuery =  newQuery + amp + pair[0] + "=" + pair[1];
+                }
+            }
+        }
+
+        if (!windowIdFound && ! freshWindow && window.name != 'xxx') {
+            // propagate the windowId manually!
+            var amp = iParam++ > 0 ? "&" : "?";
+            newQuery =  newQuery + amp + "windowId=" + window.name;
+        }
+
+        return newQuery;
+    }
+
+    window.onload=function(){
+        document.getElementById('message').textContent = "Ihre Seite wird geladen!";
+        var urlParam = getQueryVariable(window.location.search.substring(1), "url");
+        var url = decodeURIComponent(urlParam);
+
+        if (url == '') {
+            return;
+        }
+
+        url = fixWindowId(url);
+
+        window.location = url;
+    }
+</script>
+
+    </head>
+    <body bgcolor="#0f4865">
+        <div id="message" style="position:absolute;left:40%;top:40%;" >
+            Please enable JavaScript!
+        </div>
+    </body>
+</html>