You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2015/04/15 16:10:27 UTC
svn commit: r1673773 - in /openwebbeans/trunk: readme/README.txt
webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
Author: struberg
Date: Wed Apr 15 14:10:27 2015
New Revision: 1673773
URL: http://svn.apache.org/r1673773
Log:
OWB-1046 fix Exception and try to quickly fix CDI conversations.
We need to cleanly refactor our whole session and conversation integration
in the long term though.
Modified:
openwebbeans/trunk/readme/README.txt
openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
Modified: openwebbeans/trunk/readme/README.txt
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/readme/README.txt?rev=1673773&r1=1673772&r2=1673773&view=diff
==============================================================================
--- openwebbeans/trunk/readme/README.txt (original)
+++ openwebbeans/trunk/readme/README.txt Wed Apr 15 14:10:27 2015
@@ -151,7 +151,6 @@ Improvement
[OWB-652] - Introduce HierarchicBeanManager
[OWB-755] - Move the instance creation into Producer.produce
[OWB-763] - move our remaining tests from TestContext to AbstractUnitTest
- [OWB-798] - expensive check in EventUtil#checkEventBindings
[OWB-820] - cleanup of el resolvers
[OWB-932] - skip validation of the cdi-api
[OWB-937] - unify startup detection
Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java?rev=1673773&r1=1673772&r2=1673773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java (original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java Wed Apr 15 14:10:27 2015
@@ -288,23 +288,23 @@ public class WebContextsService extends
@Override
public void startContext(Class<? extends Annotation> scopeType, Object startParameter) throws ContextException
{
- if(scopeType.equals(RequestScoped.class))
+ if (scopeType.equals(RequestScoped.class))
{
initRequestContext((ServletRequestEvent)startParameter);
}
- else if(scopeType.equals(SessionScoped.class))
+ else if (scopeType.equals(SessionScoped.class))
{
initSessionContext((HttpSession)startParameter);
}
- else if(scopeType.equals(ApplicationScoped.class))
+ else if (scopeType.equals(ApplicationScoped.class))
{
initApplicationContext((ServletContext)startParameter);
}
- else if(supportsConversation && scopeType.equals(ConversationScoped.class))
+ else if (supportsConversation && scopeType.equals(ConversationScoped.class))
{
- initConversationContext((ConversationContext)startParameter);
+ initConversationContext(startParameter);
}
- else if(scopeType.equals(Dependent.class))
+ else if (scopeType.equals(Dependent.class))
{
//Do nothing
}
@@ -320,12 +320,12 @@ public class WebContextsService extends
@Override
public boolean supportsContext(Class<? extends Annotation> scopeType)
{
- if(scopeType.equals(RequestScoped.class) ||
- scopeType.equals(SessionScoped.class) ||
- scopeType.equals(ApplicationScoped.class) ||
- scopeType.equals(Dependent.class) ||
- scopeType.equals(Singleton.class) ||
- (scopeType.equals(ConversationScoped.class) && supportsConversation))
+ if (scopeType.equals(RequestScoped.class) ||
+ scopeType.equals(SessionScoped.class) ||
+ scopeType.equals(ApplicationScoped.class) ||
+ scopeType.equals(Dependent.class) ||
+ scopeType.equals(Singleton.class) ||
+ (scopeType.equals(ConversationScoped.class) && supportsConversation))
{
return true;
}
@@ -366,6 +366,8 @@ public class WebContextsService extends
//Init thread local singleton context
initSingletonContext(event.getServletContext());
+ initConversationContext(request);
+
webBeansContext.getBeanManagerImpl().fireEvent(request, InitializedLiteral.INSTANCE_REQUEST_SCOPED);
}
}
@@ -725,15 +727,24 @@ public class WebContextsService extends
/**
* Initialize conversation context.
- * @param context context
+ * @param startObject either a ServletRequest or a ConversationContext
*/
- private void initConversationContext(ConversationContext context)
+ private void initConversationContext(Object startObject)
{
- if (context == null)
+
+ if (startObject != null && startObject instanceof ConversationContext)
+ {
+ ConversationContext context = (ConversationContext) startObject;
+ context.setActive(true);
+ conversationContexts.set(context);
+ }
+ else
{
if(conversationContexts.get() == null)
{
ConversationContext newContext = new ConversationContext();
+ webBeansContext.getBeanManagerImpl().fireEvent(new Object(), InitializedLiteral.INSTANCE_CONVERSATION_SCOPED);
+
newContext.setActive(true);
conversationContexts.set(newContext);
@@ -742,13 +753,6 @@ public class WebContextsService extends
{
conversationContexts.get().setActive(true);
}
-
- webBeansContext.getBeanManagerImpl().fireEvent(new Object(), InitializedLiteral.INSTANCE_SINGLETON_SCOPED);
- }
- else
- {
- context.setActive(true);
- conversationContexts.set(context);
}
}