[jboss-cvs] jboss-seam/src/main/org/jboss/seam/contexts ...
Gavin King
gavin.king at jboss.com
Fri Nov 24 21:56:06 EST 2006
User: gavin
Date: 06/11/24 21:56:06
Modified: src/main/org/jboss/seam/contexts Contexts.java
Lifecycle.java ServerConversationContext.java
WebApplicationContext.java WebRequestContext.java
WebSessionContext.java
Log:
fix JBSEAM-524
Revision Changes Path
1.44 +12 -8 jboss-seam/src/main/org/jboss/seam/contexts/Contexts.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Contexts.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/Contexts.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- Contexts.java 10 Oct 2006 22:30:39 -0000 1.43
+++ Contexts.java 25 Nov 2006 02:56:06 -0000 1.44
@@ -16,7 +16,7 @@
*
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.43 $
+ * @version $Revision: 1.44 $
*/
public class Contexts {
@@ -180,10 +180,13 @@
log.debug("destroying: " + name);
if ( component!=null )
{
+ Object object = context.get(name);
+ if (object!=null) //in a portal environment, this is possible
+ {
if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.preDestroy." + name);
try
{
- component.callDestroyMethod( context.get(name) );
+ component.callDestroyMethod(object);
}
catch (Exception e)
{
@@ -192,6 +195,7 @@
}
}
}
+ }
finally
{
Lifecycle.stopDestroying();
1.66 +4 -3 jboss-seam/src/main/org/jboss/seam/contexts/Lifecycle.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Lifecycle.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/Lifecycle.java,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- Lifecycle.java 11 Nov 2006 02:22:29 -0000 1.65
+++ Lifecycle.java 25 Nov 2006 02:56:06 -0000 1.66
@@ -31,7 +31,7 @@
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.65 $
+ * @version $Revision: 1.66 $
*/
public class Lifecycle
{
@@ -119,7 +119,7 @@
for ( String name: context.getNames() )
{
Object object = context.get(name);
- if ( object instanceof Component )
+ if ( object!=null && (object instanceof Component) )
{
Component component = (Component) object;
if ( component.isStartup() && component.getScope()==ScopeType.APPLICATION )
@@ -184,7 +184,8 @@
for ( String name : context.getNames() )
{
Object object = context.get(name);
- if (object instanceof Component) {
+ if ( object!=null && (object instanceof Component) )
+ {
Component component = (Component) object;
if ( component.isStartup() && component.getScope() == ScopeType.SESSION )
{
1.17 +3 -3 jboss-seam/src/main/org/jboss/seam/contexts/ServerConversationContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ServerConversationContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/ServerConversationContext.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- ServerConversationContext.java 16 Nov 2006 13:19:08 -0000 1.16
+++ ServerConversationContext.java 25 Nov 2006 02:56:06 -0000 1.17
@@ -26,7 +26,7 @@
*
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.16 $
+ * @version $Revision: 1.17 $
*/
public class ServerConversationContext implements Context {
@@ -148,7 +148,7 @@
String prefix = getPrefix( getId() );
while ( names.hasMoreElements() ) {
String name = (String) names.nextElement();
- if ( name.startsWith(prefix) )
+ if ( name.startsWith(prefix) && session.getAttribute(name)!=null )
{
name = name.substring( prefix.length() );
if ( !removals.contains(name) ) results.add(name);
@@ -187,7 +187,7 @@
{
String key = getKey(name);
Object attribute = session.getAttribute(key);
- if ( Lifecycle.isAttributeDirty(attribute) )
+ if ( attribute!=null && Lifecycle.isAttributeDirty(attribute) )
{
session.setAttribute(key, attribute);
}
1.18 +5 -2 jboss-seam/src/main/org/jboss/seam/contexts/WebApplicationContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WebApplicationContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/WebApplicationContext.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- WebApplicationContext.java 29 Sep 2006 22:48:50 -0000 1.17
+++ WebApplicationContext.java 25 Nov 2006 02:56:06 -0000 1.18
@@ -18,7 +18,7 @@
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.17 $
+ * @version $Revision: 1.18 $
*/
public class WebApplicationContext implements Context
{
@@ -75,8 +75,11 @@
{
results.add( name.substring(prefix.length()) );
}*/
+ if ( servletContext.getAttribute(name)!=null )
+ {
results.add(name);
}
+ }
return results.toArray(new String[]{});
}
1.19 +5 -2 jboss-seam/src/main/org/jboss/seam/contexts/WebRequestContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WebRequestContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/WebRequestContext.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- WebRequestContext.java 11 Oct 2006 04:42:12 -0000 1.18
+++ WebRequestContext.java 25 Nov 2006 02:56:06 -0000 1.19
@@ -16,7 +16,7 @@
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.18 $
+ * @version $Revision: 1.19 $
*/
public class WebRequestContext implements Context {
@@ -71,8 +71,11 @@
{
results.add( name.substring(prefix.length()) );
}*/
+ if ( request.getAttribute(name)!=null )
+ {
results.add(name);
}
+ }
return results.toArray( new String[]{} );
}
1.26 +5 -4 jboss-seam/src/main/org/jboss/seam/contexts/WebSessionContext.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WebSessionContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/WebSessionContext.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- WebSessionContext.java 15 Nov 2006 22:12:17 -0000 1.25
+++ WebSessionContext.java 25 Nov 2006 02:56:06 -0000 1.26
@@ -16,7 +16,7 @@
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.25 $
+ * @version $Revision: 1.26 $
*/
public class WebSessionContext implements Context
{
@@ -74,7 +74,7 @@
String prefix = ScopeType.CONVERSATION.getPrefix();
while ( names.hasMoreElements() ) {
String name = (String) names.nextElement();
- if ( !name.contains(prefix) )
+ if ( !name.contains(prefix) && session.getAttribute(name)!=null )
{
results.add(name);
//results.add( name.substring(prefix.length()) );
@@ -88,11 +88,12 @@
return get( Seam.getComponentName(clazz) );
}
- public void flush() {
+ public void flush()
+ {
for ( String name: getNames() )
{
Object attribute = session.getAttribute(name);
- if ( Lifecycle.isAttributeDirty(attribute) )
+ if ( attribute!=null && Lifecycle.isAttributeDirty(attribute) )
{
session.setAttribute(name, attribute);
}
More information about the jboss-cvs-commits
mailing list