Author: pete.muir(a)jboss.org
Date: 2008-12-09 09:19:53 -0500 (Tue, 09 Dec 2008)
New Revision: 495
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterable.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java
ri/trunk/webbeans-ri/src/main/resources/
ri/trunk/webbeans-ri/src/main/resources/META-INF/
ri/trunk/webbeans-ri/src/main/resources/META-INF/faces-config.xml
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
Log:
A number of minor fixes
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java 2008-12-09
11:08:49 UTC (rev 494)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/el/WebBeansELResolver.java 2008-12-09
14:19:53 UTC (rev 495)
@@ -63,7 +63,12 @@
{
if (base == null && property != null)
{
- return CurrentManager.rootManager().getInstanceByName(property.toString());
+ Object value =
CurrentManager.rootManager().getInstanceByName(property.toString());
+ if (value != null)
+ {
+ context.setPropertyResolved(true);
+ }
+ return value;
}
else
{
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java 2008-12-09
11:08:49 UTC (rev 494)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ApplicationBeanMap.java 2008-12-09
14:19:53 UTC (rev 495)
@@ -18,6 +18,7 @@
import org.jboss.webbeans.contexts.ApplicationContext;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.util.EnumerationIterable;
/**
* Abstracts the servlet API specific application context
@@ -43,9 +44,16 @@
}
+ @SuppressWarnings("unchecked")
public void clear()
{
- throw new UnsupportedOperationException();
+ for (String name : new
EnumerationIterable<String>(servletContext.getAttributeNames()))
+ {
+ if (name.startsWith(getKeyPrefix()))
+ {
+ servletContext.removeAttribute(name);
+ }
+ }
}
@SuppressWarnings("unchecked")
@@ -84,7 +92,7 @@
String name = (String) names.nextElement();
if (name.startsWith(getKeyPrefix()))
{
- String id = name.substring(getKeyPrefix().length());
+ String id = name.substring(getKeyPrefix().length() + 1);
Contextual<?> bean =
CurrentManager.rootManager().getBeans().get(Integer.parseInt(id));
beans.add(bean);
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2008-12-09
11:08:49 UTC (rev 494)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2008-12-09
14:19:53 UTC (rev 495)
@@ -86,6 +86,7 @@
*/
public static void endSession(HttpSession session)
{
+ SessionContext.INSTANCE.setBeanMap(new SessionBeanMap(session));
SessionContext.INSTANCE.destroy();
SessionContext.INSTANCE.setBeanMap(null);
}
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterable.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterable.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterable.java 2008-12-09
14:19:53 UTC (rev 495)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.util;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+public class EnumerationIterable<T> implements Iterable<T>
+{
+
+ private EnumerationIterator<T> iterator;
+
+ public EnumerationIterable(Enumeration<T> enumeration)
+ {
+ this.iterator = new EnumerationIterator<T>(enumeration);
+ }
+
+ public Iterator<T> iterator()
+ {
+ return iterator;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java 2008-12-09
14:19:53 UTC (rev 495)
@@ -0,0 +1,37 @@
+package org.jboss.webbeans.util;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+public class EnumerationIterator<T> implements Iterator<T>,
Iterable<T>
+{
+ private Enumeration e;
+
+ public EnumerationIterator(Enumeration e)
+ {
+ this.e = e;
+ }
+
+ public boolean hasNext()
+ {
+ return e.hasMoreElements();
+ }
+
+ public T next()
+ {
+ return (T) e.nextElement();
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator<T> iterator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/EnumerationIterator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/resources/META-INF/faces-config.xml
===================================================================
--- ri/trunk/webbeans-ri/src/main/resources/META-INF/faces-config.xml
(rev 0)
+++ ri/trunk/webbeans-ri/src/main/resources/META-INF/faces-config.xml 2008-12-09 14:19:53
UTC (rev 495)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<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">
+
+ <application>
+ <el-resolver>org.jboss.webbeans.el.WebBeansELResolver</el-resolver>
+ </application>
+
+</faces-config>
Property changes on: ri/trunk/webbeans-ri/src/main/resources/META-INF/faces-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain