[weld-commits] Weld SVN: r4829 - in extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet: util and 1 other directory.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Sun Nov 8 23:51:55 EST 2009
Author: dan.j.allen
Date: 2009-11-08 23:51:55 -0500 (Sun, 08 Nov 2009)
New Revision: 4829
Added:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/TransparentELResolver.java
Modified:
extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WeldApplication.java
Log:
use transparent ELResolver rather than throwing exception if ForwardingELResolver
is consulted before the BeanManager is ready
this is necessary since it could be used when loading eager JSF managed beans
Modified: extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WeldApplication.java
===================================================================
--- extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WeldApplication.java 2009-11-09 03:59:12 UTC (rev 4828)
+++ extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/jsf/WeldApplication.java 2009-11-09 04:51:55 UTC (rev 4829)
@@ -26,6 +26,7 @@
import org.jboss.weld.environment.servlet.util.ForwardingELResolver;
import org.jboss.weld.environment.servlet.util.Reflections;
+import org.jboss.weld.environment.servlet.util.TransparentELResolver;
/**
* @author Pete Muir
@@ -41,8 +42,12 @@
*/
private static class LazyBeanManagerIntegrationELResolver extends ForwardingELResolver
{
- private ELResolver delegate = null;
+ private ELResolver delegate;
+ public LazyBeanManagerIntegrationELResolver() {
+ delegate = new TransparentELResolver();
+ }
+
public void beanManagerReady(BeanManager beanManager)
{
this.delegate = beanManager.getELResolver();
@@ -51,9 +56,6 @@
@Override
protected ELResolver delegate()
{
- if (delegate == null) {
- throw new IllegalStateException("Attempt to use JSR-299 ELResolver before BeanManager initialized.");
- }
return delegate;
}
}
Added: extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/TransparentELResolver.java
===================================================================
--- extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/TransparentELResolver.java (rev 0)
+++ extensions/trunk/servlet/int/src/main/java/org/jboss/weld/environment/servlet/util/TransparentELResolver.java 2009-11-09 04:51:55 UTC (rev 4829)
@@ -0,0 +1,53 @@
+package org.jboss.weld.environment.servlet.util;
+
+import java.beans.FeatureDescriptor;
+import java.util.Iterator;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+
+/**
+ * An ELResolver that behaves as though it is invisible, meaning it's
+ * indempontent to the chain and the next ELResolver in the line will be
+ * consulted.
+ *
+ * @author Dan Allen
+ */
+public class TransparentELResolver extends ELResolver
+{
+ @Override
+ public Class<?> getCommonPropertyType(ELContext arg0, Object arg1)
+ {
+ return null;
+ }
+
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext arg0, Object arg1)
+ {
+ return null;
+ }
+
+ @Override
+ public Class<?> getType(ELContext arg0, Object arg1, Object arg2)
+ {
+ return null;
+ }
+
+ @Override
+ public Object getValue(ELContext arg0, Object arg1, Object arg2)
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext arg0, Object arg1, Object arg2)
+ {
+ return false;
+ }
+
+ @Override
+ public void setValue(ELContext arg0, Object arg1, Object arg2, Object arg3)
+ {
+ }
+
+}
More information about the weld-commits
mailing list