[jboss-cvs] jboss-seam/src/main/org/jboss/seam/contexts ...
Gavin King
gavin.king at jboss.com
Sat Jul 21 01:41:36 EDT 2007
User: gavin
Date: 07/07/21 01:41:36
Modified: src/main/org/jboss/seam/contexts EntityBean.java
FacesLifecycle.java
Log:
JBSEAM-1604
Revision Changes Path
1.14 +1 -1 jboss-seam/src/main/org/jboss/seam/contexts/EntityBean.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EntityBean.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/EntityBean.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- EntityBean.java 21 Jun 2007 21:55:30 -0000 1.13
+++ EntityBean.java 21 Jul 2007 05:41:36 -0000 1.14
@@ -48,7 +48,7 @@
else
{
passivatedEntity = passivateEntity(instance);
- if (passivatedEntity!=null) instance = null; //for performance of serialization
+ //if (passivatedEntity!=null) instance = null; //for performance of serialization
}
return true;
}
1.8 +34 -5 jboss-seam/src/main/org/jboss/seam/contexts/FacesLifecycle.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FacesLifecycle.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/FacesLifecycle.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- FacesLifecycle.java 22 Jun 2007 09:18:40 -0000 1.7
+++ FacesLifecycle.java 21 Jul 2007 05:41:36 -0000 1.8
@@ -10,6 +10,7 @@
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
+import org.jboss.seam.ScopeType;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.navigation.Pages;
@@ -62,14 +63,42 @@
public static void beginExceptionRecovery(ExternalContext externalContext)
{
log.debug(">>> Begin exception recovery");
+
+ //application and session contexts are easy :-)
Contexts.applicationContext.set( new ApplicationContext( externalContext.getApplicationMap() ) );
- Contexts.eventContext.set( new EventContext( externalContext.getRequestMap() ) );
Contexts.sessionContext.set( new SessionContext( externalContext.getSessionMap() ) );
- ServerConversationContext conversationContext = new ServerConversationContext( externalContext.getSessionMap() );
- Contexts.conversationContext.set(conversationContext);
+
+ //don't really have anything good to do with these ones:
Contexts.pageContext.set(null);
Contexts.businessProcessContext.set(null); //TODO: is this really correct?
- conversationContext.unflush();
+
+ //depending upon when the exception occurs, endRequest() may or may not get called
+ //by SeamPhaseListener - this is because the stupid JSF spec gives me know way to
+ //determine if an exception occurred during the phase :-/
+ if ( Contexts.isEventContextActive() )
+ {
+ //this means that endRequest() never ran, so the components in the EVENT context
+ //have not yet been destroyed, and we can re-use them
+ Contexts.eventContext.set( new EventContext( externalContext.getRequestMap() ) );
+ }
+ else
+ {
+ //the endRequest() method already ran, so the EVENT context is in principle empty,
+ //but we can't use the actual ServletRequest, since it contains garbage components
+ //that have already been destroyed (we could change that in EventContext!)
+ Contexts.eventContext.set( new BasicContext(ScopeType.EVENT) );
+ }
+
+ //for the conversation context, we need to account for flushing
+ //note that since we can't guarantee that it's components get flushed
+ //to the session, there is always a possibility of components that were
+ //newly created in the current request "leaking" (we could fix that by
+ //copying unflushed changes in the context object into the new context
+ //object, or we could fix it by flushing at the end of every phase)
+ boolean conversationContextFlushed = !Contexts.isConversationContextActive();
+ ServerConversationContext conversationContext = new ServerConversationContext( externalContext.getSessionMap() );
+ Contexts.conversationContext.set(conversationContext);
+ if (conversationContextFlushed) conversationContext.unflush();
}
public static void endRequest(ExternalContext externalContext)
More information about the jboss-cvs-commits
mailing list