[jboss-cvs] jboss-seam/src/main/org/jboss/seam/web ...
Gavin King
gavin.king at jboss.com
Sat Jul 21 01:41:37 EDT 2007
User: gavin
Date: 07/07/21 01:41:37
Modified: src/main/org/jboss/seam/web ExceptionFilter.java
Log:
JBSEAM-1604
Revision Changes Path
1.24 +19 -16 jboss-seam/src/main/org/jboss/seam/web/ExceptionFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ExceptionFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/ExceptionFilter.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- ExceptionFilter.java 19 Jul 2007 09:30:57 -0000 1.23
+++ ExceptionFilter.java 21 Jul 2007 05:41:37 -0000 1.24
@@ -19,12 +19,15 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.jboss.seam.Seam;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.web.Filter;
+import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.contexts.FacesLifecycle;
+import org.jboss.seam.core.ConversationPropagation;
import org.jboss.seam.core.Manager;
import org.jboss.seam.exception.Exceptions;
import org.jboss.seam.log.LogProvider;
@@ -73,7 +76,7 @@
{
//TODO: Are we really sure that someone flushes the "old"
// conversation context before we get to here? I guess
- // the phaselistener probably does it, but we want to
+ // the PhaseListener probably does it, but we want to
// make sure of that...
log.debug("running exception handlers");
@@ -81,23 +84,23 @@
MockFacesContext facesContext = createFacesContext(request, response);
facesContext.setCurrent();
- //Init the temp context objects
- //TODO: note that this code is pretty dodgy since in theory
- // Manager has already been destroyed, and now we are
- // re-using it (and all other request-scoped objects).
- // Should create a new request context that does not
- // map back to the servlet request context, and "copy"
- // the conversation id over.
- FacesLifecycle.beginExceptionRecovery( facesContext.getExternalContext() );
-
- //if there is an existing long-running conversation on
- //the thread, propagate it
- Manager manager = Manager.instance();
- if ( !manager.isLongRunningOrNestedConversation() )
+ //if the event context was cleaned up, fish the conversation id
+ //directly out of the ServletRequest attributes
+ String conversationId = null;
+ if ( !Contexts.isEventContextActive() )
{
- manager.initializeTemporaryConversation();
+ Manager oldManager = (Manager) request.getAttribute( Seam.getComponentName(Manager.class) );
+ conversationId = oldManager.getCurrentConversationId();
}
+ //Initialize the temporary context objects
+ FacesLifecycle.beginExceptionRecovery( facesContext.getExternalContext() );
+
+ //If there is an existing long-running conversation on
+ //the failed request, propagate it
+ ConversationPropagation.instance().setConversationId(conversationId);
+ Manager.instance().restoreConversation();
+
//Now do the exception handling
try
{
@@ -118,7 +121,7 @@
}
finally
{
- //finally, clean up the temp contexts
+ //Finally, clean up the contexts
try
{
FacesLifecycle.endRequest( facesContext.getExternalContext() );
More information about the jboss-cvs-commits
mailing list