You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2009/01/30 00:09:26 UTC

svn commit: r739072 - in /myfaces/portlet-bridge/core/trunk: api/src/main/java/javax/portlet/faces/ examples/blank/src/main/webapp/WEB-INF/ examples/demo/src/main/webapp/WEB-INF/ impl/src/main/java/org/apache/myfaces/portlet/faces/application/ impl/src...

Author: mfreedman
Date: Thu Jan 29 23:09:25 2009
New Revision: 739072

URL: http://svn.apache.org/viewvc?rev=739072&view=rev
Log:
Fixes PORTLETBRIDGE-61, PORTLETBRIDGE-60, PORTLETBRIDGE-59, and PORTLETBRIDGE-58.

PB-61:  restoring from cached view has been moved from ViewHandler to before we run the lifecycle.

PB-60: create/init portlet now done in a synchronized block.

PB-59: Various face-config.xml(s) updated to provide a schemaLocation for the JSF schema so validation can occur.

PB-58:  Changed impl to recreate Lifecycle object per request vs. using a shared single copy stored as a private data member.

Modified:
    myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
    myfaces/portlet-bridge/core/trunk/examples/blank/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/web.xml
    myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java
    myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
    myfaces/portlet-bridge/core/trunk/impl/src/main/resources/META-INF/faces-config.xml

Modified: myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java?rev=739072&r1=739071&r2=739072&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java (original)
+++ myfaces/portlet-bridge/core/trunk/api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java Thu Jan 29 23:09:25 2009
@@ -120,6 +120,7 @@
   private Class<? extends Bridge> mFacesBridgeClass = null;
   private Bridge mFacesBridge = null;
   private HashMap<String, String> mDefaultViewIdMap = null;
+  private Object mLock = new Object();  // used to synchronize on when initializing the bridge.
 
   /**
    * Initialize generic faces portlet from portlet.xml
@@ -532,9 +533,17 @@
     {
       try
       {
-        mFacesBridge = mFacesBridgeClass.newInstance();
-        mFacesBridge.init(getPortletConfig());
-      } catch (Exception e)
+        // ensure we only ever create/init one bridge per portlet
+        synchronized(mLock)
+        {
+          if (mFacesBridge == null)
+          {
+            mFacesBridge = mFacesBridgeClass.newInstance();
+            mFacesBridge.init(getPortletConfig());
+          }
+        }
+      }
+      catch (Exception e)
       {
         throw new PortletException("doBridgeDisptach:  error instantiating the bridge class", e);
       }

Modified: myfaces/portlet-bridge/core/trunk/examples/blank/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/examples/blank/src/main/webapp/WEB-INF/faces-config.xml?rev=739072&r1=739071&r2=739072&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/examples/blank/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/portlet-bridge/core/trunk/examples/blank/src/main/webapp/WEB-INF/faces-config.xml Thu Jan 29 23:09:25 2009
@@ -1,25 +1,25 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE faces-config PUBLIC
-  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
-  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
-<faces-config xmlns="http://java.sun.com/JSF/Configuration">
-  <navigation-rule>
-    <from-view-id>*</from-view-id>
-    <navigation-case>
-      <from-outcome>helloWorld</from-outcome>
-      <to-view-id>/index.jsp</to-view-id>
-    </navigation-case>
-  </navigation-rule>
-  <navigation-rule>
-    <from-view-id>/index.jsp</from-view-id>
-    <navigation-case>
-      <from-outcome>sayhello</from-outcome>
-      <to-view-id>/hello.jsp</to-view-id>
-    </navigation-case>
-  </navigation-rule>
-  <managed-bean>
-    <managed-bean-name>namebean</managed-bean-name>
-    <managed-bean-class>org.apache.myfaces.portlet.faces.demo.helloworld.NameBean</managed-bean-class>
-    <managed-bean-scope>request</managed-bean-scope>
-  </managed-bean>
-</faces-config>
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+  <navigation-rule>
+    <from-view-id>*</from-view-id>
+    <navigation-case>
+      <from-outcome>helloWorld</from-outcome>
+      <to-view-id>/index.jsp</to-view-id>
+    </navigation-case>
+  </navigation-rule>
+  <navigation-rule>
+    <from-view-id>/index.jsp</from-view-id>
+    <navigation-case>
+      <from-outcome>sayhello</from-outcome>
+      <to-view-id>/hello.jsp</to-view-id>
+    </navigation-case>
+  </navigation-rule>
+  <managed-bean>
+    <managed-bean-name>namebean</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.portlet.faces.demo.helloworld.NameBean</managed-bean-class>
+    <managed-bean-scope>request</managed-bean-scope>
+  </managed-bean>
+</faces-config>

Modified: myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/faces-config.xml?rev=739072&r1=739071&r2=739072&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/faces-config.xml Thu Jan 29 23:09:25 2009
@@ -1,25 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE faces-config PUBLIC
-  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
-  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
-<faces-config xmlns="http://java.sun.com/JSF/Configuration">
-  <navigation-rule>
-    <from-view-id>*</from-view-id>
-    <navigation-case>
-      <from-outcome>helloWorld</from-outcome>
-      <to-view-id>/helloworld/index.jsp</to-view-id>
-    </navigation-case>
-  </navigation-rule>
-  <navigation-rule>
-    <from-view-id>/helloworld/index.jsp</from-view-id>
-    <navigation-case>
-      <from-outcome>sayhello</from-outcome>
-      <to-view-id>/helloworld/hello.jsp</to-view-id>
-    </navigation-case>
-  </navigation-rule>
-  <managed-bean>
-    <managed-bean-name>namebean</managed-bean-name>
-    <managed-bean-class>org.apache.myfaces.portlet.faces.demo.helloworld.NameBean</managed-bean-class>
-    <managed-bean-scope>request</managed-bean-scope>
-  </managed-bean>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+  <navigation-rule>
+    <from-view-id>*</from-view-id>
+    <navigation-case>
+      <from-outcome>helloWorld</from-outcome>
+      <to-view-id>/helloworld/index.jsp</to-view-id>
+    </navigation-case>
+  </navigation-rule>
+  <navigation-rule>
+    <from-view-id>/helloworld/index.jsp</from-view-id>
+    <navigation-case>
+      <from-outcome>sayhello</from-outcome>
+      <to-view-id>/helloworld/hello.jsp</to-view-id>
+    </navigation-case>
+  </navigation-rule>
+  <managed-bean>
+    <managed-bean-name>namebean</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.portlet.faces.demo.helloworld.NameBean</managed-bean-class>
+    <managed-bean-scope>request</managed-bean-scope>
+  </managed-bean>
 </faces-config>
\ No newline at end of file

Modified: myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/web.xml?rev=739072&r1=739071&r2=739072&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/portlet-bridge/core/trunk/examples/demo/src/main/webapp/WEB-INF/web.xml Thu Jan 29 23:09:25 2009
@@ -1,51 +1,55 @@
-<?xml version = '1.0' encoding = 'ISO-8859-1'?>
-<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.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.
-	   
--->
-<!-- The Jetty Pluto Plugin needs to have a Webapp 2.3 web-xml.  Don't know why. -->
-<web-app>
+<?xml version = '1.0' encoding = 'ISO-8859-1'?>
+<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.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.
+	   
+-->
+<!-- The Jetty Pluto Plugin needs to have a Webapp 2.3 web-xml.  Don't know why. -->
+<web-app>
   <context-param>
-    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
-    <param-value>.jsp</param-value>
-  </context-param>
-  
-  <!-- Listener, to allow Jetty serving MyFaces apps -->
-  <!-- TODO: is this needed anymore for jetty?  I don't think so.. -->
-  <!-- listener>
-    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
-  </listener -->
-
-  <!-- Faces Servlet -->
-  <servlet>
-    <servlet-name>faces</servlet-name>
-    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
-  </servlet>
-
-  <!-- Faces Servlet Mappings -->
-  <!-- 
-    In this demo application, I chose to use suffix mapping.  I did this because it makes urls
-    in the portlet world look nicer in the source.  The portlet url should be the same 
-    reguardless.
-  -->
-  <servlet-mapping>
-    <servlet-name>faces</servlet-name>
-    <url-pattern>*.jsf</url-pattern>
-  </servlet-mapping>
-</web-app>
+    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+    <param-value>.jsp</param-value>
+  </context-param>
+  <context-param>
+    <param-name>com.sun.faces.validateXml</param-name>
+    <param-value>true</param-value>
+  </context-param>
+  
+  <!-- Listener, to allow Jetty serving MyFaces apps -->
+  <!-- TODO: is this needed anymore for jetty?  I don't think so.. -->
+  <!-- listener>
+    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+  </listener -->
+
+  <!-- Faces Servlet -->
+  <servlet>
+    <servlet-name>faces</servlet-name>
+    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+  </servlet>
+
+  <!-- Faces Servlet Mappings -->
+  <!-- 
+    In this demo application, I chose to use suffix mapping.  I did this because it makes urls
+    in the portlet world look nicer in the source.  The portlet url should be the same 
+    reguardless.
+  -->
+  <servlet-mapping>
+    <servlet-name>faces</servlet-name>
+    <url-pattern>*.jsf</url-pattern>
+  </servlet-mapping>
+</web-app>

Modified: myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java?rev=739072&r1=739071&r2=739072&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java (original)
+++ myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java Thu Jan 29 23:09:25 2009
@@ -204,36 +204,6 @@
     }
   }
   
-  
-  @Override
-  public UIViewRoot restoreView(FacesContext context, String viewId)
-  {
-    /* Because Faces doesn't support saving a view following an action, the bridge
-     * caches the view and restores the view from the cache for the first render.
-     * Once a render occurs the view is saved/restored from the Faces StateManager. 
-     * The view(root) is cached in the bridge request scope which means that
-     * by the time we are asked to restore here, the view(root) is a request
-     * attribute.  Logic below merely checks to see if this attribute exists. 
-     * If it does it removes the attribute from the request scope ensuring it
-     * won't be used in the future and then returns it.  Otherwise it delegates to
-     * the regular Faces restoration process.
-     */
-      
-    Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
-    UIViewRoot viewRoot = (UIViewRoot) requestMap.get(BridgeImpl.FACES_VIEWROOT);
-    if (viewRoot != null)
-    {
-      // remove from current Request Scope
-      requestMap.remove(BridgeImpl.FACES_VIEWROOT);
-    }
-    else
-    {
-      viewRoot = super.restoreView(context, viewId);
-    }
-    
-    return viewRoot;
-  }
-
 
   @Override
   public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException,

Modified: myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java?rev=739072&r1=739071&r2=739072&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java (original)
+++ myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java Thu Jan 29 23:09:25 2009
@@ -123,7 +123,8 @@
 
   private PortletConfig mPortletConfig = null;
   private FacesContextFactory mFacesContextFactory = null;
-  private Lifecycle mLifecycle = null;
+  private LifecycleFactory mLifecycleFactory = null;
+  private String mLifecycleId = null;
   private List<String> mFacesMappings = null;
   private boolean mInitialized = false;
 
@@ -270,11 +271,12 @@
     String scopeId = null;
     try
     {
+      Lifecycle lifecycle = getLifecycle();
       // Get the FacesContext instance for this request
-      context = getFacesContext(request, response, getLifecycle(), null);
+      context = getFacesContext(request, response, lifecycle, null);
 
       // For actions we only execute the lifecycle phase
-      getLifecycle().execute(context);
+      lifecycle.execute(context);
 
       // If responseComplete don't save any state as we aren't falling through to render
       // Usual occurs because of a redirect
@@ -513,6 +515,11 @@
         // VIEW_STATE
         // parameter -- always attempt a restore
         extRequest = restoreActionParams(context);
+        
+        // only restores if first render after action
+        // afterwards not restored from Bridge request scope
+        // rather its saved/restored by Faces.
+        restoreFacesView(context, scopeId);
       }  
 
       // Ensure the ContentType is set before rendering
@@ -622,35 +629,25 @@
     // will create a new Tree instead of restoring one -- the semantics
     // one should get if the Bridge can't access its requestScope.
 
-    // if the requestScope restored the ViewRoot then this must be
-    // the first render after the action -- hence the tree isn't yet
-    // stored/managed by Faces -- we can merely render it
-    if (context.getViewRoot() == null)
-    {
-      // add self as PhaseListener to prevent action phases from
-      // executing
-      lifecycle.addPhaseListener(this);
-      try
-      {
-        lifecycle.execute(context);
-      }
-      catch (Exception e)
-      {
-        // When exception occurs remove stored scope so don't
-        // get stuck replaying the error when/if user refreshes
-        if (scopeId != null)
-        {
-          removeRequestScopes(scopeId);
-        }
-      }
-      finally
+    // add self as PhaseListener to prevent action phases from
+    // executing
+    lifecycle.addPhaseListener(this);
+    try
+    {
+      lifecycle.execute(context);
+    }
+    catch (Exception e)
+    {
+      // When exception occurs remove stored scope so don't
+      // get stuck replaying the error when/if user refreshes
+      if (scopeId != null)
       {
-        lifecycle.removePhaseListener(this);
+        removeRequestScopes(scopeId);
       }
     }
-    else
+    finally
     {
-      throw new BridgeException("Shouldn't get here -- disabled cached restore.");
+      lifecycle.removePhaseListener(this);
     }
       
     // check here to see if a redirect occurred -- if so rerun doFacesRequest
@@ -660,7 +657,7 @@
     
     if (redirectParams == null)
     {
-      getLifecycle().render(context);
+      lifecycle.render(context);
     }
     else
     {
@@ -972,20 +969,18 @@
   {
     try
     {
-      if (mLifecycle == null)
+      if (mLifecycleFactory == null)
       {
-        LifecycleFactory lifecycleFactory = 
+        mLifecycleFactory = 
           (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
-        String lifecycleId = 
+        mLifecycleId = 
           mPortletConfig.getPortletContext().getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR);
-        if (lifecycleId == null)
+        if (mLifecycleId == null)
         {
-          lifecycleId = LifecycleFactory.DEFAULT_LIFECYCLE;
+          mLifecycleId = LifecycleFactory.DEFAULT_LIFECYCLE;
         }
-
-        mLifecycle = lifecycleFactory.getLifecycle(lifecycleId);
       }
-      return mLifecycle;
+      return mLifecycleFactory.getLifecycle(mLifecycleId);
     }
     catch (FacesException e)
     {
@@ -1004,6 +999,22 @@
     Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
     requestMap.put(FACES_VIEWROOT, context.getViewRoot());
   }
+  
+  private void restoreFacesView(FacesContext context, String scopeId)
+  {
+    Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+    UIViewRoot viewRoot = (UIViewRoot) requestMap.get(FACES_VIEWROOT);
+    if (viewRoot != null)
+    {
+      context.setViewRoot(viewRoot);
+      // remove from current Request Scope and the saved Bridge Request
+      // Scope
+      requestMap.remove(FACES_VIEWROOT);
+      removeFromBridgeRequestScopeData(context, scopeId, FACES_VIEWROOT);
+    }
+    
+    // Messages get restored in a phase listener
+  }  
 
   private void saveActionParams(FacesContext context)
   {

Modified: myfaces/portlet-bridge/core/trunk/impl/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/impl/src/main/resources/META-INF/faces-config.xml?rev=739072&r1=739071&r2=739072&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/impl/src/main/resources/META-INF/faces-config.xml (original)
+++ myfaces/portlet-bridge/core/trunk/impl/src/main/resources/META-INF/faces-config.xml Thu Jan 29 23:09:25 2009
@@ -1,37 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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.	   
--->
-<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
-    xmlns:bridge="http://www.apache.org/myfaces/xml/ns/bridge/bridge-extension">
-    <application>
-        <view-handler>org.apache.myfaces.portlet.faces.application.PortletViewHandlerImpl</view-handler>
-        <state-manager>org.apache.myfaces.portlet.faces.application.PortletStateManagerImpl</state-manager>
-        <el-resolver>org.apache.myfaces.portlet.faces.el.PortletELResolver</el-resolver>
-        <application-extension>
-          <bridge:excluded-attributes>
-            <bridge:excluded-attribute>com.sun.faces.*</bridge:excluded-attribute>
-            <bridge:excluded-attribute>org.apache.myfaces.application.jsp.JspStateManagerImpl.*</bridge:excluded-attribute>
-            <bridge:excluded-attribute>org.apache.myfaces.el.unified.resolver.managedbean.*</bridge:excluded-attribute>
-            <bridge:excluded-attribute>org.apache.myfaces.shared_impl.renderkit.RendererUtils.*</bridge:excluded-attribute>
-            <bridge:excluded-attribute>org.apache.myfaces.application.DefaultViewHandlerSupport.*</bridge:excluded-attribute>
-            <bridge:excluded-attribute>jsf_sequence</bridge:excluded-attribute>
-          </bridge:excluded-attributes>       
-        </application-extension>
-    </application>
-</faces-config>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.	   
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+    xmlns:bridge="http://www.apache.org/myfaces/xml/ns/bridge/bridge-extension"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+    <application>
+        <view-handler>org.apache.myfaces.portlet.faces.application.PortletViewHandlerImpl</view-handler>
+        <state-manager>org.apache.myfaces.portlet.faces.application.PortletStateManagerImpl</state-manager>
+        <el-resolver>org.apache.myfaces.portlet.faces.el.PortletELResolver</el-resolver>
+        <application-extension>
+          <bridge:excluded-attributes>
+            <bridge:excluded-attribute>com.sun.faces.*</bridge:excluded-attribute>
+            <bridge:excluded-attribute>org.apache.myfaces.application.jsp.JspStateManagerImpl.*</bridge:excluded-attribute>
+            <bridge:excluded-attribute>org.apache.myfaces.el.unified.resolver.managedbean.*</bridge:excluded-attribute>
+            <bridge:excluded-attribute>org.apache.myfaces.shared_impl.renderkit.RendererUtils.*</bridge:excluded-attribute>
+            <bridge:excluded-attribute>org.apache.myfaces.application.DefaultViewHandlerSupport.*</bridge:excluded-attribute>
+            <bridge:excluded-attribute>jsf_sequence</bridge:excluded-attribute>
+          </bridge:excluded-attributes>       
+        </application-extension>
+    </application>
+</faces-config>