openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r905137 - /openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java
Date Sun, 31 Jan 2010 23:15:14 GMT
Author: gerdogdu
Date: Sun Jan 31 23:15:13 2010
New Revision: 905137

URL: http://svn.apache.org/viewvc?rev=905137&view=rev
Log:
Updating conversation propogation

Modified:
    openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java

Modified: openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java?rev=905137&r1=905136&r2=905137&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java
(original)
+++ openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/WebBeansPhaseListener.java
Sun Jan 31 23:15:13 2010
@@ -19,7 +19,6 @@
 import javax.faces.event.PhaseEvent;
 import javax.faces.event.PhaseId;
 import javax.faces.event.PhaseListener;
-import javax.servlet.http.HttpServletRequest;
 
 import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.context.ContextFactory;
@@ -50,13 +49,14 @@
      */
     public void afterPhase(PhaseEvent phaseEvent)
     {
-        if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE))
+        if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE) ||
+                JSFUtil.getCurrentFacesContext().getResponseComplete())
         {
         	Conversation conversation = conversationManager.getConversationBeanReference();
         	
             if (conversation.isTransient())
             {
-                logger.info(OWBLogConst.INFO_0041, new Object[]{conversation.getId(), JSFUtil.getViewId()});
+                logger.info(OWBLogConst.INFO_0041, new Object[]{conversation.getId()});
                 ContextFactory.destroyConversationContext();                            
                       
             }
             else
@@ -66,13 +66,7 @@
                 owbConversation.updateTimeOut();
                 //Other threads can now access propogated conversation.
                 owbConversation.setInUsed(false);                
-            }
-            
-            HttpServletRequest request = (HttpServletRequest)phaseEvent.getFacesContext().getExternalContext().getRequest();
-            if(request.getMethod().equals("POST"))
-            {
-                JSFUtil.getSession().removeAttribute("POST_CONVERSATION");
-            }
+            }            
         }
     }
 
@@ -81,15 +75,8 @@
      */
     public void beforePhase(PhaseEvent phaseEvent)
     {
-        HttpServletRequest request = (HttpServletRequest)phaseEvent.getFacesContext().getExternalContext().getRequest();
-        
         if (phaseEvent.getPhaseId().equals(PhaseId.RESTORE_VIEW))
         {
-            if(request.getMethod().equals("POST"))
-            {
-                JSFUtil.getSession().setAttribute("POST_CONVERSATION", true);
-            }
-            
             //It looks for cid parameter in the JSF request.
             //If request contains cid, then it must restore conversation
             //Otherwise create NonexistentException
@@ -98,7 +85,7 @@
         	
 			if (conversation.isTransient())
 			{
-				logger.info(OWBLogConst.INFO_0043, new Object[]{conversation.getId(), JSFUtil.getViewId()});
+				logger.info(OWBLogConst.INFO_0043, new Object[]{conversation.getId()});
 				ContextFactory.initConversationContext(null);
 				
 	            //Not restore, throw exception
@@ -109,26 +96,12 @@
 			}
 			else
 			{
-				logger.info(OWBLogConst.INFO_0042, new Object[]{conversation.getId(), JSFUtil.getViewId()});
+				logger.info(OWBLogConst.INFO_0042, new Object[]{conversation.getId()});
 				
 				//Conversation must be used by one thread at a time
 				ConversationImpl owbConversation = (ConversationImpl)conversation;
 				if(!owbConversation.getInUsed().compareAndSet(false, true))
-				{
-				    if(request.getMethod().equals("GET"))
-				    {
-				        //POST-Redirect-GET
-				        if(JSFUtil.getSession().getAttribute("POST_CONVERSATION") != null)
-				        {
-			                   ConversationContext conversationContext = conversationManager.getConversationContext(conversation);
-			                   ContextFactory.initConversationContext(conversationContext);
-			                   
-			                   JSFUtil.getSession().removeAttribute("POST_CONVERSATION");
-			                   
-			                   return;
-				        }
-				    }
-				    
+				{				    
 				    ContextFactory.initConversationContext(null);
 				    //Throw Busy exception
 				    throw new BusyConversationException("Propogated conversation with cid=" + cid + "
is used by other request. It creates a new transient conversation");



Mime
View raw message