Author: mrdon
Date: Fri Sep  8 09:56:01 2006
New Revision: 441572

URL: http://svn.apache.org/viewvc?view=rev&rev=441572
Log:
Changed jsf warning to occur only when trying to use interceptors, not on 
startup

Modified:
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesInterceptor.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSupport.java

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesInterceptor.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesInterceptor.java?view=diff&rev=441572&r1=441571&r2=441572
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesInterceptor.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesInterceptor.java
 Fri Sep  8 09:56:01 2006
@@ -31,12 +31,6 @@
 
     private static final long serialVersionUID = -5418255964277566516L;
 
-    /** 
-     * Marker key for the ActionContext to dictate whether to treat the request
-     * as a JSF faces request and therefore process the Faces phases
-     */
-    protected static final String FACES_ENABLED = "facesEnabled";
-
     /**
      * Not used
      */

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java?view=diff&rev=441572&r1=441571&r2=441572
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java
 Fri Sep  8 09:56:01 2006
@@ -133,11 +133,6 @@
             log.debug("Unable to initialize faces", ex);
         }
 
-        if (facesContextFactory == null) {
-            log
-                    .info("Unable to initialize jsf interceptors probably due 
missing JSF framework initialization");
-            return;
-        }
         // Javadoc says: Lifecycle instance is shared across multiple
         // simultaneous requests, it must be implemented in a thread-safe
         // manner.
@@ -213,26 +208,30 @@
      *            The action invocation
      */
     public String intercept(ActionInvocation invocation) throws Exception {
-        if (facesContextFactory != null && isFacesAction(invocation)) {
-
-            invocation.getInvocationContext().put(
-                    FacesInterceptor.FACES_ENABLED, Boolean.TRUE);
-
-            FacesContext facesContext = facesContextFactory.getFacesContext(
-                    ServletActionContext.getServletContext(),
-                    ServletActionContext.getRequest(), ServletActionContext
-                            .getResponse(), lifecycle);
-
-            setLifecycle(lifecycle);
-
-            try {
-                return invocation.invoke();
-            } finally {
-                facesContext.release();
+        if (facesContextFactory != null)
+        {
+            if (isFacesAction(invocation)) {
+
+                invocation.getInvocationContext().put(
+                        FacesInterceptor.FACES_ENABLED, Boolean.TRUE);
+
+                FacesContext facesContext = 
facesContextFactory.getFacesContext(
+                        ServletActionContext.getServletContext(),
+                        ServletActionContext.getRequest(), ServletActionContext
+                                .getResponse(), lifecycle);
+
+                setLifecycle(lifecycle);
+
+                try {
+                    return invocation.invoke();
+                } finally {
+                    facesContext.release();
+                }
             }
         } else {
-            return invocation.invoke();
+            log.error("Unable to initialize jsf interceptors probably due 
missing JSF implementation libraries");
         }
+        return invocation.invoke();
     }
 
     /**

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSupport.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSupport.java?view=diff&rev=441572&r1=441571&r2=441572
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSupport.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/jsf/FacesSupport.java
 Fri Sep  8 09:56:01 2006
@@ -38,14 +38,20 @@
        /** Log instance for each class */
        protected Log log;
 
-       /** Initializes log instance for the instance object */
-       protected FacesSupport() {
-               log = LogFactory.getLog(getClass());
-       }
+    /**
+     * Marker key for the ActionContext to dictate whether to treat the request
+     * as a JSF faces request and therefore process the Faces phases
+     */
+    protected static final String FACES_ENABLED = "facesEnabled";
+
+    /** Initializes log instance for the instance object */
+    protected FacesSupport() {
+        log = LogFactory.getLog(getClass());
+    }
 
        /**
         * Gets the shared lifecycle for this request
-        * 
+        *
         * @return The lifecycle
         */
        private Lifecycle getLifecycle() {
@@ -54,7 +60,7 @@
 
        /**
         * Sets the lifecycle for this request
-        * 
+        *
         * @param lifecycle
         *            The lifecycle
         */
@@ -64,7 +70,7 @@
 
        /**
         * Informs phase listeners before a phase is executed
-        * 
+        *
         * @param facesContext
         *            The current faces context
         * @param phaseId
@@ -88,7 +94,7 @@
 
        /**
         * Informs phase listeners after a phase is executed
-        * 
+        *
         * @param facesContext
         *            The current faces context
         * @param phaseId
@@ -113,7 +119,7 @@
        /**
         * Checks to see if the response has been completed. Mainly used for 
better
         * debugging messages.
-        * 
+        *
         * @param facesContext
         *            The current faces context
         * @param phase
@@ -140,7 +146,7 @@
        /**
         * Checks to see the render phase should be executed next. Mainly used 
for
         * better debugging messages.
-        * 
+        *
         * @param facesContext
         *            The current faces context
         * @param phase


Reply via email to