[jboss-cvs] jboss-seam/src/main/org/jboss/seam/contexts ...
Gavin King
gavin.king at jboss.com
Tue Oct 10 15:37:37 EDT 2006
User: gavin
Date: 06/10/10 15:37:37
Modified: src/main/org/jboss/seam/contexts Lifecycle.java
ServerConversationContext.java
WebSessionContext.java
Log:
removed @Mutable, use Mutable interface instead
Revision Changes Path
1.58 +7 -1 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.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- Lifecycle.java 10 Oct 2006 18:12:31 -0000 1.57
+++ Lifecycle.java 10 Oct 2006 19:37:37 -0000 1.58
@@ -27,7 +27,7 @@
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.57 $
+ * @version $Revision: 1.58 $
*/
public class Lifecycle
{
@@ -355,6 +355,12 @@
}
+ if ( Contexts.isSessionContextActive() )
+ {
+ log.debug("flushing session context");
+ Contexts.getSessionContext().flush();
+ }
+
//destroy the event context after the
//conversation context, since we need
//the manager to flush() conversation
1.10 +13 -1 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.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- ServerConversationContext.java 3 Oct 2006 23:15:58 -0000 1.9
+++ ServerConversationContext.java 10 Oct 2006 19:37:37 -0000 1.10
@@ -17,6 +17,7 @@
import org.jboss.seam.Seam;
import org.jboss.seam.core.Events;
import org.jboss.seam.core.Manager;
+import org.jboss.seam.core.Mutable;
/**
* A conversation context is a logical context that lasts longer than
@@ -24,7 +25,7 @@
*
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public class ServerConversationContext implements Context {
@@ -170,6 +171,17 @@
*/
public void flush()
{
+
+ for ( String name: getNamesFromSession() )
+ {
+ String key = getKey(name);
+ Object attribute = session.getAttribute(key);
+ if ( attribute instanceof Mutable && ( (Mutable) attribute ).clearDirty() )
+ {
+ session.setAttribute(key, attribute);
+ }
+ }
+
Manager manager = Manager.instance();
boolean longRunning = manager.isLongRunningConversation() ||
!manager.getCurrentConversationId().equals( getId() );
1.22 +12 -2 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.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- WebSessionContext.java 29 Sep 2006 22:48:50 -0000 1.21
+++ WebSessionContext.java 10 Oct 2006 19:37:37 -0000 1.22
@@ -12,11 +12,12 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.Seam;
import org.jboss.seam.core.Events;
+import org.jboss.seam.core.Mutable;
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.21 $
+ * @version $Revision: 1.22 $
*/
public class WebSessionContext implements Context
{
@@ -88,6 +89,15 @@
return get( Seam.getComponentName(clazz) );
}
- public void flush() {}
+ public void flush() {
+ for ( String name: getNames() )
+ {
+ Object attribute = session.getAttribute(name);
+ if ( attribute instanceof Mutable && ( (Mutable) attribute ).clearDirty() )
+ {
+ session.setAttribute(name, attribute);
+ }
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list