struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r473326 - in /struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application: FacesRequestProcessor.java FacesTilesRequestProcessor.java
Date Fri, 10 Nov 2006 12:58:07 GMT
Author: niallp
Date: Fri Nov 10 04:58:06 2006
New Revision: 473326

URL: http://svn.apache.org/viewvc?view=rev&rev=473326
Log:
Fix STR-2973 - Allow Struts-Faces to work with custom JSF lifecycles - patch from Matthias
Wessendorf

Modified:
    struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesRequestProcessor.java
    struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesTilesRequestProcessor.java

Modified: struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesRequestProcessor.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesRequestProcessor.java?view=diff&rev=473326&r1=473325&r2=473326
==============================================================================
--- struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesRequestProcessor.java
(original)
+++ struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesRequestProcessor.java
Fri Nov 10 04:58:06 2006
@@ -74,6 +74,10 @@
     protected static Log log = LogFactory.getLog(FacesRequestProcessor.class);
 
 
+    /**
+     * <p>The lifecycle id.</p>
+     */
+    public static final String LIFECYCLE_ID_ATTR = "javax.faces.LIFECYCLE_ID";
 
     // ------------------------------------------------------- Protected Methods
 
@@ -123,8 +127,8 @@
         // Create a FacesContext for this request if necessary
         LifecycleFactory lf = (LifecycleFactory)
             FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
-        Lifecycle lifecycle = // FIXME - alternative lifecycle ids
-            lf.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+        Lifecycle lifecycle = 
+            lf.getLifecycle(getLifecycleId());
         boolean created = false;
         FacesContext context = FacesContext.getCurrentInstance();
         if (context == null) {
@@ -426,6 +430,15 @@
 
     // --------------------------------------------------------- Private Methods
 
+
+    /**
+     * <p>Return the used Lifecycle ID (default or custom).</p>
+     */
+    private String getLifecycleId()
+    {
+        String lifecycleId = this.servlet.getServletContext().getInitParameter(LIFECYCLE_ID_ATTR);
+        return lifecycleId != null ? lifecycleId : LifecycleFactory.DEFAULT_LIFECYCLE;
+    }  
 
     /**
      * <p>Return <code>true</code> if the specified context-relative URI

Modified: struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesTilesRequestProcessor.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesTilesRequestProcessor.java?view=diff&rev=473326&r1=473325&r2=473326
==============================================================================
--- struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesTilesRequestProcessor.java
(original)
+++ struts/struts1/trunk/faces/src/main/java/org/apache/struts/faces/application/FacesTilesRequestProcessor.java
Fri Nov 10 04:58:06 2006
@@ -73,6 +73,10 @@
     protected static Log log =
         LogFactory.getLog(FacesTilesRequestProcessor.class);
 
+    /**
+     * <p>The lifecycle id.</p>
+     */
+    public static final String LIFECYCLE_ID_ATTR = "javax.faces.LIFECYCLE_ID";
 
 
     // ------------------------------------------------------- Protected Methods
@@ -123,8 +127,8 @@
         // Create a FacesContext for this request if necessary
         LifecycleFactory lf = (LifecycleFactory)
             FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
-        Lifecycle lifecycle = // FIXME - alternative lifecycle ids
-            lf.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+        Lifecycle lifecycle = 
+            lf.getLifecycle(getLifecycleId());
         boolean created = false;
         FacesContext context = FacesContext.getCurrentInstance();
         if (context == null) {
@@ -440,6 +444,15 @@
 
     // --------------------------------------------------------- Private Methods
 
+
+    /**
+     * <p>Return the used Lifecycle ID (default or custom).</p>
+     */
+    private String getLifecycleId()
+    {
+        String lifecycleId = this.servlet.getServletContext().getInitParameter(LIFECYCLE_ID_ATTR);
+        return lifecycleId != null ? lifecycleId : LifecycleFactory.DEFAULT_LIFECYCLE;
+    }  
 
     /**
      * <p>Return <code>true</code> if the specified context-relative URI



Mime
View raw message