You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2010/08/13 00:31:28 UTC

svn commit: r985018 - in /myfaces/extensions/cdi/trunk/jee-modules: jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/ jsf-m...

Author: gpetracek
Date: Thu Aug 12 22:31:27 2010
New Revision: 985018

URL: http://svn.apache.org/viewvc?rev=985018&view=rev
Log:
EXTCDI-1, EXTCDI-2 and EXTCDI-3 view handler

Added:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowIdAwareViewHandler.java
Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/META-INF/faces-config.xml
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/META-INF/faces-config.xml

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java?rev=985018&r1=985017&r2=985018&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java Thu Aug 12 22:31:27 2010
@@ -40,14 +40,10 @@ public interface ConfigParameter
 
     static final boolean ALLOW_UNKNOWN_WINDOW_IDS_DEFAULT = false;
 
-    //TODO impl. should encode just the page url - otherwise we have to rename this config entry
-    @Deprecated
     static final String ADD_WINDOW_ID_TO_ACTION_URL_ENABLED =
             CoreCodiConfigParameter.BASE_NAME + "ADD_WINDOW_ID_TO_ACTION_URL_ENABLED";
 
-    //for now we need the default 'true' due to the default approach
-    @Deprecated
-    static final boolean ADD_WINDOW_ID_TO_ACTION_URL_ENABLED_DEFAULT = true;
+    static final boolean ADD_WINDOW_ID_TO_ACTION_URL_ENABLED_DEFAULT = false;
 
     static final String DISABLE_INITIAL_REDIRECT =
             CoreCodiConfigParameter.BASE_NAME + "DISABLE_INITIAL_REDIRECT";

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowIdAwareViewHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowIdAwareViewHandler.java?rev=985018&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowIdAwareViewHandler.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowIdAwareViewHandler.java Thu Aug 12 22:31:27 2010
@@ -0,0 +1,64 @@
+/*
+ * 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.javaee.jsf.impl.scope.conversation;
+
+import org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.spi.WindowHandler;
+import org.apache.myfaces.extensions.cdi.javaee.jsf.impl.util.ConversationUtils;
+
+import javax.faces.application.ViewHandlerWrapper;
+import javax.faces.application.ViewHandler;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class WindowIdAwareViewHandler extends ViewHandlerWrapper
+{
+    private ViewHandler wrapped;
+
+    private WindowHandler windowHandler;
+
+    public WindowIdAwareViewHandler(ViewHandler wrapped)
+    {
+        this.wrapped = wrapped;
+    }
+
+    protected ViewHandler getWrapped()
+    {
+        return this.wrapped;
+    }
+
+    @Override
+    public String getActionURL(FacesContext context, String viewId)
+    {
+        lazyInit();
+
+        String url = this.wrapped.getActionURL(context, viewId);
+        url = this.windowHandler.encodeURL(url);
+        return url;
+    }
+
+    private synchronized void lazyInit()
+    {
+        if(this.windowHandler == null)
+        {
+            this.windowHandler = ConversationUtils.getWindowHandler();
+        }
+    }
+}

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/META-INF/faces-config.xml?rev=985018&r1=985017&r2=985018&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/META-INF/faces-config.xml (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/META-INF/faces-config.xml Thu Aug 12 22:31:27 2010
@@ -26,6 +26,8 @@
     <application>
         <navigation-handler>org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.AccessScopeAwareNavigationHandler</navigation-handler>
         <navigation-handler>org.apache.myfaces.extensions.cdi.javaee.jsf.impl.view.flow.FlowNavigationHandler</navigation-handler>
+
+        <view-handler>org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.WindowIdAwareViewHandler</view-handler>
     </application>
 
     <factory>

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/META-INF/faces-config.xml?rev=985018&r1=985017&r2=985018&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/META-INF/faces-config.xml (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/resources/META-INF/faces-config.xml Thu Aug 12 22:31:27 2010
@@ -25,6 +25,8 @@
     <application>
         <navigation-handler>org.apache.myfaces.extensions.cdi.javaee.jsf.impl.view.flow.FlowNavigationHandler</navigation-handler>
         <navigation-handler>org.apache.myfaces.extensions.cdi.javaee.jsf2.impl.scope.conversation.AccessScopeAwareNavigationHandler</navigation-handler>
+
+        <view-handler>org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.WindowIdAwareViewHandler</view-handler>
     </application>
 
     <factory>