You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/12/12 10:00:12 UTC
svn commit: r603515 -
/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java
Author: imario
Date: Wed Dec 12 01:00:11 2007
New Revision: 603515
URL: http://svn.apache.org/viewvc?rev=603515&view=rev
Log:
create proxies per conversation, required to make viewController-scope
work correctly again
Modified:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java?rev=603515&r1=603514&r2=603515&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java Wed Dec 12 01:00:11 2007
@@ -43,6 +43,9 @@
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* Abstract basis class for all the Orchestra scopes.
* <p>
@@ -228,17 +231,28 @@
}
BeanDefinition beanDefinition = applicationContext.getBeanFactory().getBeanDefinition(beanName);
- Object proxy = beanDefinition.getAttribute(ScopedBeanTargetSource.class.getName());
+ String conversationName = getConversationNameForBean(beanName);
+
+ // deal with proxies required for multiple conversations.
+ // This is required to make the viewController scope work where proxies are
+ // required for each conversation a bean has been requested.
+ Map proxies = (Map) beanDefinition.getAttribute(ScopedBeanTargetSource.class.getName());
+ if (proxies == null)
+ {
+ proxies = new HashMap();
+ beanDefinition.setAttribute(ScopedBeanTargetSource.class.getName(), proxies);
+ }
+
+ Object proxy = proxies.get(conversationName);
if (proxy == null)
{
if (log.isDebugEnabled())
{
log.debug("getProxy: creating proxy for " + beanName);
}
- String conversationName = getConversationNameForBean(beanName);
BeanFactory beanFactory = applicationContext.getBeanFactory();
proxy = _SpringUtils.newProxy(this, conversationName, beanName, objectFactory, beanFactory);
- beanDefinition.setAttribute(ScopedBeanTargetSource.class.getName(), proxy);
+ proxies.put(conversationName, proxy);
}
// Register the proxy in req scope. The first lookup of a variable using an EL expression during a