You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/11/12 23:42:58 UTC

svn commit: r1034589 - /myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/ConverterBase.java

Author: lu4242
Date: Fri Nov 12 22:42:57 2010
New Revision: 1034589

URL: http://svn.apache.org/viewvc?rev=1034589&view=rev
Log:
add cached FacesContext

Modified:
    myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/ConverterBase.java

Modified: myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/ConverterBase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/ConverterBase.java?rev=1034589&r1=1034588&r2=1034589&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/ConverterBase.java (original)
+++ myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/ConverterBase.java Fri Nov 12 22:42:57 2010
@@ -50,6 +50,9 @@ public abstract class ConverterBase impl
     private String _summaryMessage = null;
     private String _detailMessage = null;
     private boolean _transient = false;
+    
+    private transient FacesContext _facesContext;
+
 
     /**
      * alternate conversion error summary message format string
@@ -315,11 +318,28 @@ public abstract class ConverterBase impl
         }
     }
 
-
     protected FacesContext getFacesContext()
     {
-        return FacesContext.getCurrentInstance();
+        if (_facesContext == null)
+        {
+            return FacesContext.getCurrentInstance();
+        }
+        else
+        {
+            return _facesContext;
+        }
+    }
+    
+    boolean isCachedFacesContext()
+    {
+        return _facesContext != null;
+    }
+    
+    void setCachedFacesContext(FacesContext facesContext)
+    {
+        _facesContext = facesContext;
     }
+    
     protected String getStringValue(FacesContext context, ValueExpression vb)
     {
         Object value = vb.getValue(context.getELContext());