You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by rm...@apache.org on 2014/12/28 22:29:02 UTC
svn commit: r1648255 -
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java
Author: rmannibucau
Date: Sun Dec 28 21:29:01 2014
New Revision: 1648255
URL: http://svn.apache.org/r1648255
Log:
starting conversation scope if needed when begin is called
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java?rev=1648255&r1=1648254&r2=1648255&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationImpl.java Sun Dec 28 21:29:01 2014
@@ -143,7 +143,7 @@ public class ConversationImpl implements
//Gets current conversation context instance.
//Each conversation has its own conversation context instance.
//Sets at the beginning of each JSF request.
- manager.addConversationContext(this, (ConversationContext) webBeansContext.getBeanManagerImpl().getContext(ConversationScoped.class));
+ manager.addConversationContext(this, getOrStartConversationScope());
}
catch (ContextNotActiveException cnae)
@@ -163,7 +163,22 @@ public class ConversationImpl implements
throw new IllegalStateException();
}
}
-
+
+ private ConversationContext getOrStartConversationScope()
+ {
+ ConversationContext context = (ConversationContext) webBeansContext.getContextsService().getCurrentContext(ConversationScoped.class);
+ if (context == null)
+ {
+ webBeansContext.getContextsService().startContext(ConversationScoped.class, null);
+ context = (ConversationContext) webBeansContext.getContextsService().getCurrentContext(ConversationScoped.class);
+ }
+ if (!context.isActive())
+ {
+ context.setActive(true);
+ }
+ return context;
+ }
+
/**
* {@inheritDoc}
*/
@@ -191,7 +206,8 @@ public class ConversationImpl implements
}
}
updateTimeOut();
- conversationManager.addConversationContext(this, (ConversationContext) webBeansContext.getBeanManagerImpl().getContext(ConversationScoped.class));
+
+ conversationManager.addConversationContext(this, getOrStartConversationScope());
}
}