deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [2/4] git commit: DELTASPIKE-454 - refactored
Date Thu, 09 Jan 2014 10:49:01 GMT
 DELTASPIKE-454 - refactored

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

Branch: refs/heads/master
Commit: 50190f0393cc9e4b5275b13b01c1ee1a9dd174dc
Parents: c156d05
Author: andraschko <andraschko@Dev-4.ifvuf.de>
Authored: Thu Jan 9 10:44:43 2014 +0100
Committer: andraschko <andraschko@Dev-4.ifvuf.de>
Committed: Thu Jan 9 10:44:43 2014 +0100

----------------------------------------------------------------------
 .../DeltaSpikeExternalContextWrapper.java       | 14 ++-
 .../request/DeltaSpikeFacesContextFactory.java  |  7 +-
 .../request/DeltaSpikeFacesContextWrapper.java  | 18 +++-
 .../request/DeltaSpikeLifecycleWrapper.java     |  9 +-
 .../JsfClientWindowAwareLifecycleWrapper.java   |  8 +-
 .../impl/scope/window/ClientWindowHelper.java   | 99 --------------------
 .../impl/scope/window/DefaultClientWindow.java  | 16 ++--
 .../jsf/impl/util/ClientWindowHelper.java       | 94 +++++++++++++++++++
 .../jsf/impl/view/DeltaSpikeViewHandler.java    | 10 +-
 9 files changed, 148 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/50190f03/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeExternalContextWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeExternalContextWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeExternalContextWrapper.java
index c67bbff..bf99621 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeExternalContextWrapper.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeExternalContextWrapper.java
@@ -25,24 +25,32 @@ import javax.faces.context.ExternalContext;
 import javax.faces.context.ExternalContextWrapper;
 import java.io.IOException;
 import javax.faces.context.FacesContext;
-import org.apache.deltaspike.jsf.impl.scope.window.ClientWindowHelper;
+import org.apache.deltaspike.jsf.impl.util.ClientWindowHelper;
+import org.apache.deltaspike.jsf.spi.scope.window.ClientWindow;
 
 public class DeltaSpikeExternalContextWrapper extends ExternalContextWrapper implements Deactivatable
 {
     private final ExternalContext wrapped;
+    private final ClientWindow clientWindow;
 
-    DeltaSpikeExternalContextWrapper(ExternalContext wrapped)
+    DeltaSpikeExternalContextWrapper(ExternalContext wrapped, ClientWindow clientWindow)
     {
         this.wrapped = wrapped;
+        this.clientWindow = clientWindow;
     }
 
     @Override
     public void redirect(String url) throws IOException
     {
         JsfUtils.saveFacesMessages(this.wrapped);
-        this.wrapped.redirect(ClientWindowHelper.appendWindowId(FacesContext.getCurrentInstance(),
url));
+
+        String targetURL = ClientWindowHelper.appendWindowId(FacesContext.getCurrentInstance(),
+                url, this.clientWindow);
+
+        this.wrapped.redirect(targetURL);
     }
 
+    @Override
     public ExternalContext getWrapped()
     {
         return wrapped;

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/50190f03/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
index e1fef76..8295c5d 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
@@ -24,6 +24,8 @@ import org.apache.deltaspike.core.util.ClassDeactivationUtils;
 import javax.faces.context.FacesContext;
 import javax.faces.context.FacesContextFactory;
 import javax.faces.lifecycle.Lifecycle;
+import org.apache.deltaspike.core.api.provider.BeanProvider;
+import org.apache.deltaspike.jsf.spi.scope.window.ClientWindow;
 
 public class DeltaSpikeFacesContextFactory extends FacesContextFactory implements Deactivatable
 {
@@ -31,6 +33,8 @@ public class DeltaSpikeFacesContextFactory extends FacesContextFactory implement
 
     private final boolean deactivated;
 
+    private final ClientWindow clientWindow;
+
     /**
      * Constructor for wrapping the given {@link FacesContextFactory}
      *
@@ -40,6 +44,7 @@ public class DeltaSpikeFacesContextFactory extends FacesContextFactory implement
     {
         this.wrappedFacesContextFactory = wrappedFacesContextFactory;
         this.deactivated = !ClassDeactivationUtils.isActivated(getClass());
+        this.clientWindow = BeanProvider.getContextualReference(ClientWindow.class, true);
     }
 
     /**
@@ -61,7 +66,7 @@ public class DeltaSpikeFacesContextFactory extends FacesContextFactory implement
             return facesContext;
         }
 
-        return new DeltaSpikeFacesContextWrapper(facesContext);
+        return new DeltaSpikeFacesContextWrapper(facesContext, clientWindow);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/50190f03/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
index 5b11d38..5229b73 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java
@@ -35,6 +35,7 @@ import javax.faces.context.FacesContextWrapper;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CopyOnWriteArrayList;
+import org.apache.deltaspike.jsf.spi.scope.window.ClientWindow;
 
 class DeltaSpikeFacesContextWrapper extends FacesContextWrapper
 {
@@ -48,14 +49,16 @@ class DeltaSpikeFacesContextWrapper extends FacesContextWrapper
 
     private JsfModuleConfig jsfModuleConfig;
 
-    DeltaSpikeFacesContextWrapper(FacesContext wrappedFacesContext)
+    private volatile Boolean initialized;
+
+    DeltaSpikeFacesContextWrapper(FacesContext wrappedFacesContext, ClientWindow clientWindow)
     {
         this.wrappedFacesContext = wrappedFacesContext;
 
         if (ClassDeactivationUtils.isActivated(DeltaSpikeExternalContextWrapper.class))
         {
             this.wrappedExternalContext =
-                    new DeltaSpikeExternalContextWrapper(wrappedFacesContext.getExternalContext());
+                    new DeltaSpikeExternalContextWrapper(wrappedFacesContext.getExternalContext(),
clientWindow);
         }
         else
         {
@@ -105,7 +108,16 @@ class DeltaSpikeFacesContextWrapper extends FacesContextWrapper
 
     private void lazyInit()
     {
-        if (this.beforeAfterJsfRequestBroadcaster == null)
+        if (this.initialized == null)
+        {
+            init();
+        }
+    }
+
+    private synchronized void init()
+    {
+        // switch into paranoia mode
+        if (initialized == null)
         {
             if (ClassDeactivationUtils.isActivated(BeforeAfterJsfRequestBroadcaster.class))
             {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/50190f03/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java
index 44ee9db..050083b 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java
@@ -133,14 +133,11 @@ class DeltaSpikeLifecycleWrapper extends Lifecycle
             {
                 beforeAfterJsfRequestBroadcaster =
                         BeanProvider.getContextualReference(BeforeAfterJsfRequestBroadcaster.class,
true);
-
-                clientWindow =
-                        BeanProvider.getContextualReference(ClientWindow.class, true);
-
-                windowContext =
-                        BeanProvider.getContextualReference(WindowContext.class, true);
             }
 
+            clientWindow = BeanProvider.getContextualReference(ClientWindow.class, true);
+            windowContext = BeanProvider.getContextualReference(WindowContext.class, true);
+
             initialized = true;
         }
     }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/50190f03/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
index 12a41ef..13c66a1 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
@@ -19,7 +19,6 @@
 package org.apache.deltaspike.jsf.impl.listener.request;
 
 import org.apache.deltaspike.core.api.provider.BeanProvider;
-import org.apache.deltaspike.core.util.ClassDeactivationUtils;
 import org.apache.deltaspike.core.util.ExceptionUtils;
 import org.apache.deltaspike.jsf.api.config.JsfModuleConfig;
 import org.apache.deltaspike.jsf.impl.scope.window.ClientWindowAdapter;
@@ -153,11 +152,8 @@ public class JsfClientWindowAwareLifecycleWrapper extends LifecycleWrapper
         // switch into paranoia mode
         if (initialized == null)
         {
-            if (ClassDeactivationUtils.isActivated(BeforeAfterJsfRequestBroadcaster.class))
-            {
-                delegateWindowHandling =
-                    BeanProvider.getContextualReference(JsfModuleConfig.class).isDelegatedWindowHandlingEnabled();
-            }
+            delegateWindowHandling =
+                BeanProvider.getContextualReference(JsfModuleConfig.class).isDelegatedWindowHandlingEnabled();
 
             initialized = true;
         }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/50190f03/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/ClientWindowHelper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/ClientWindowHelper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/ClientWindowHelper.java
deleted file mode 100644
index 5137054..0000000
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/ClientWindowHelper.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.deltaspike.jsf.impl.scope.window;
-
-import java.util.Map;
-import java.util.Map.Entry;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import org.apache.deltaspike.core.api.provider.BeanProvider;
-import org.apache.deltaspike.jsf.impl.util.JsfUtils;
-import org.apache.deltaspike.jsf.spi.scope.window.ClientWindow;
-
-public final class ClientWindowHelper
-{
-    private ClientWindowHelper()
-    {
-
-    }
-
-    /**
-     * Handles the initial redirect for the URL modus, if no windowId is available in the
current request URL.
-     *
-     * @param facesContext the {@link FacesContext}
-     */
-    public static void handleInitialRedirect(FacesContext facesContext)
-    {
-        ExternalContext externalContext = facesContext.getExternalContext();
-
-        // send initial redirect to add the windowId to the current request URL
-        String viewId = facesContext.getApplication().getViewHandler().deriveViewId(
-                facesContext, externalContext.getRequestServletPath());
-
-        // The NavigationHandler tries to access the UIViewRoot but it isn't available because
our
-        // ClientWindow will be initialized before the normal JSF lifecycle
-        UIViewRoot viewRoot = new UIViewRoot();
-        viewRoot.setViewId(viewId);
-        facesContext.setViewRoot(viewRoot);
-
-        String outcome = viewId + "?faces-redirect=true&includeViewParams=true";
-        // append it manually - includeViewParams doesn't work here because of the not fully
initialized UIViewRoot
-        outcome = JsfUtils.addRequestParameters(externalContext, outcome, true);
-
-        facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext,
null, outcome);
-    }
-
-    /**
-     * Appends the current windowIf to the given url, if enabled via
-     * {@link ClientWindow#isClientWindowRenderModeEnabled(javax.faces.context.FacesContext)}
-     *
-     * @param facesContext the {@link FacesContext}
-     * @param url the url
-     * @return if enabled, the url with windowId, otherwise the umodified url
-     */
-    public static String appendWindowId(FacesContext facesContext, String url)
-    {
-        ClientWindow clientWindow = BeanProvider.getContextualReference(ClientWindow.class);
-        if (clientWindow != null && clientWindow.isClientWindowRenderModeEnabled(FacesContext.getCurrentInstance()))
-        {
-            Map<String, String> parameters = clientWindow.getQueryURLParameters(facesContext);
-
-            if (parameters != null && !parameters.isEmpty())
-            {
-                String targetUrl = url;
-
-                for (Entry<String, String> entry : parameters.entrySet())
-                {
-                    // NOTE: each call will instantiate a new StringBuilder
-                    // i didn't optimized this call because it's unlikely that there will
be multiple parameters
-                    targetUrl = JsfUtils.addParameter(facesContext.getExternalContext(),
-                            targetUrl,
-                            true,
-                            entry.getKey(),
-                            entry.getValue());
-                }
-
-                return targetUrl;
-            }
-        }
-
-        return url;
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/50190f03/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/DefaultClientWindow.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/DefaultClientWindow.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/DefaultClientWindow.java
index a34c84f..e26574e 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/DefaultClientWindow.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/window/DefaultClientWindow.java
@@ -18,6 +18,7 @@
  */
 package org.apache.deltaspike.jsf.impl.scope.window;
 
+import org.apache.deltaspike.jsf.impl.util.ClientWindowHelper;
 import javax.enterprise.context.ApplicationScoped;
 import javax.faces.FacesException;
 import javax.faces.context.ExternalContext;
@@ -121,15 +122,14 @@ public class DefaultClientWindow extends ClientWindow
         {
             ExternalContext externalContext = facesContext.getExternalContext();
 
-            if (facesContext.getAttributes().containsKey(NEW_WINDOW_ID))
-            {
-                return (String) facesContext.getAttributes().get(NEW_WINDOW_ID);
-            }
-            else if (externalContext.getRequestParameterMap().containsKey(DELTASPIKE_WINDOW_ID_URL_PARAM))
+            String windowId = (String) facesContext.getAttributes().get(NEW_WINDOW_ID);
+
+            if (windowId == null)
             {
-                return externalContext.getRequestParameterMap().get(DELTASPIKE_WINDOW_ID_URL_PARAM);
+                windowId = externalContext.getRequestParameterMap().get(DELTASPIKE_WINDOW_ID_URL_PARAM);
             }
-            else
+
+            if (windowId == null)
             {
                 // store the new windowId as context attribute to prevent infinite loops
                 // the #sendRedirect will append the windowId (from #getWindowId again) to
the redirectUrl
@@ -138,6 +138,8 @@ public class DefaultClientWindow extends ClientWindow
                 facesContext.responseComplete();
                 return null;
             }
+
+            return windowId;
         }
 
         if (facesContext.isPostback())

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/50190f03/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ClientWindowHelper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ClientWindowHelper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ClientWindowHelper.java
new file mode 100644
index 0000000..a6c9b4c
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ClientWindowHelper.java
@@ -0,0 +1,94 @@
+/*
+ * 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.deltaspike.jsf.impl.util;
+
+import java.util.Map;
+import java.util.Map.Entry;
+import javax.enterprise.inject.Typed;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import org.apache.deltaspike.jsf.spi.scope.window.ClientWindow;
+
+@Typed()
+public abstract class ClientWindowHelper
+{
+    /**
+     * Handles the initial redirect for the URL modus, if no windowId is available in the
current request URL.
+     *
+     * @param facesContext the {@link FacesContext}
+     */
+    public static void handleInitialRedirect(FacesContext facesContext)
+    {
+        ExternalContext externalContext = facesContext.getExternalContext();
+
+        // send initial redirect to add the windowId to the current request URL
+        String viewId = facesContext.getApplication().getViewHandler().deriveViewId(
+                facesContext, externalContext.getRequestServletPath());
+
+        // The NavigationHandler tries to access the UIViewRoot but it isn't available because
our
+        // ClientWindow will be initialized before the normal JSF lifecycle
+        UIViewRoot viewRoot = new UIViewRoot();
+        viewRoot.setViewId(viewId);
+        facesContext.setViewRoot(viewRoot);
+
+        String outcome = viewId + "?faces-redirect=true&includeViewParams=true";
+        // append it manually - includeViewParams doesn't work here because of the not fully
initialized UIViewRoot
+        outcome = JsfUtils.addRequestParameters(externalContext, outcome, true);
+
+        facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext,
null, outcome);
+    }
+
+    /**
+     * Appends the current windowId to the given url, if enabled via
+     * {@link ClientWindow#isClientWindowRenderModeEnabled(javax.faces.context.FacesContext)}
+     *
+     * @param facesContext the {@link FacesContext}
+     * @param url the url
+     * @param clientWindow the {@link ClientWindow} to use
+     * @return if enabled, the url with windowId, otherwise the umodified url
+     */
+    public static String appendWindowId(FacesContext facesContext, String url, ClientWindow
clientWindow)
+    {
+        if (clientWindow != null && clientWindow.isClientWindowRenderModeEnabled(facesContext))
+        {
+            Map<String, String> parameters = clientWindow.getQueryURLParameters(facesContext);
+
+            if (parameters != null && !parameters.isEmpty())
+            {
+                String targetUrl = url;
+
+                for (Entry<String, String> entry : parameters.entrySet())
+                {
+                    // NOTE: each call will instantiate a new StringBuilder
+                    // i didn't optimized this call because it's unlikely that there will
be multiple parameters
+                    targetUrl = JsfUtils.addParameter(facesContext.getExternalContext(),
+                            targetUrl,
+                            true,
+                            entry.getKey(),
+                            entry.getValue());
+                }
+
+                return targetUrl;
+            }
+        }
+
+        return url;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/50190f03/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/view/DeltaSpikeViewHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/view/DeltaSpikeViewHandler.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/view/DeltaSpikeViewHandler.java
index 234a50e..1c0ebaa 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/view/DeltaSpikeViewHandler.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/view/DeltaSpikeViewHandler.java
@@ -26,7 +26,9 @@ import javax.faces.application.ViewHandler;
 import javax.faces.application.ViewHandlerWrapper;
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
-import org.apache.deltaspike.jsf.impl.scope.window.ClientWindowHelper;
+import org.apache.deltaspike.core.api.provider.BeanProvider;
+import org.apache.deltaspike.jsf.impl.util.ClientWindowHelper;
+import org.apache.deltaspike.jsf.spi.scope.window.ClientWindow;
 
 /**
  * Aggregates all {@link ViewHandler} implementations provided by DeltaSpike
@@ -36,6 +38,7 @@ public class DeltaSpikeViewHandler extends ViewHandlerWrapper implements
Deactiv
     protected final ViewHandler wrapped;
 
     private final ViewHandler securityAwareViewHandler;
+    private final ClientWindow clientWindow;
 
     /**
      * Constructor for wrapping the given {@link ViewHandler}
@@ -54,6 +57,8 @@ public class DeltaSpikeViewHandler extends ViewHandlerWrapper implements
Deactiv
         {
             this.securityAwareViewHandler = null;
         }
+
+        this.clientWindow = BeanProvider.getContextualReference(ClientWindow.class, true);
     }
 
     //allows custom implementations to override the SecurityAwareViewHandler
@@ -75,7 +80,8 @@ public class DeltaSpikeViewHandler extends ViewHandlerWrapper implements
Deactiv
     @Override
     public String getActionURL(FacesContext context, String viewId)
     {
-        return ClientWindowHelper.appendWindowId(context, this.wrapped.getActionURL(context,
viewId));
+        String actionURL = this.wrapped.getActionURL(context, viewId);
+        return ClientWindowHelper.appendWindowId(context, actionURL, clientWindow);
     }
 
     @Override


Mime
View raw message