honour resetHttpSessionAttributeOnBeanAccess in AbstractConversationContext
@@ -75,6 +75,8 @@ public abstract class AbstractConversationContext<R, S> extends AbstractBoundCon
private final AtomicLong defaultTimeout;
private final AtomicLong concurrentAccessTimeout;
+ private final boolean resetHttpSessionAttributeOnBeanAccess;
+
private final ThreadLocal<R> associated;
private final BeanManagerImpl manager;
@@ -102,6 +104,7 @@ public abstract class AbstractConversationContext<R, S> extends AbstractBoundCon
this.associated = new ThreadLocal<R>();
this.manager = Container.instance(contextId).deploymentManager();
this.beanIdentifierIndex = services.get(BeanIdentifierIndex.class);
+ this.resetHttpSessionAttributeOnBeanAccess = configuration.getBooleanProperty(ConfigurationKey.RESET_HTTP_SESSION_ATTR_ON_BEAN_ACCESS);
}
@Override
@@ -170,7 +173,7 @@ public abstract class AbstractConversationContext<R, S> extends AbstractBoundCon
setSessionAttribute(request, CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME, conversationIdGenerator, false);
}
Object conversationMap = getRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME);
- if (conversationMap != null && getSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, false) == null) {
+ if (conversationMap != null && (resetHttpSessionAttributeOnBeanAccess || getSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, false) == null)) {
setSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap, false);
}
}
@@ -486,6 +489,9 @@ public abstract class AbstractConversationContext<R, S> extends AbstractBoundCon
conversationMap = Collections.synchronizedMap(new HashMap<String, ManagedConversation>());
setRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap);
setSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap, false);
+ } else if (resetHttpSessionAttributeOnBeanAccess) {
+ setRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap);
+ setSessionAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap, false);
} else {
setRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME, conversationMap);
}
