You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2010/08/12 04:57:24 UTC
svn commit: r984635 - in
/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl:
scope/conversation/DefaultWindowContextManager.java util/RequestCache.java
Author: gpetracek
Date: Thu Aug 12 02:57:23 2010
New Revision: 984635
URL: http://svn.apache.org/viewvc?rev=984635&view=rev
Log:
EXTCDI-33 cached window context
Modified:
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/RequestCache.java
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.java?rev=984635&r1=984634&r2=984635&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.java Thu Aug 12 02:57:23 2010
@@ -86,22 +86,26 @@ public class DefaultWindowContextManager
public WindowContext getCurrentWindowContext()
{
- String windowContextId = RequestCache.getCurrentWindowId();
+ WindowContext windowContext = RequestCache.getCurrentWindowContext();
- if(windowContextId == null)
+ if(windowContext != null)
{
- windowContextId = resolveWindowContextId(this.jsfAwareWindowContextConfig.isUrlParameterSupported(),
- this.windowHandler);
+ return windowContext;
+ }
- if (windowContextId == null)
- {
- windowContextId = createNewWindowContextId();
- }
+ String windowContextId =
+ resolveWindowContextId(this.jsfAwareWindowContextConfig.isUrlParameterSupported(), this.windowHandler);
- RequestCache.setCurrentWindowId(windowContextId);
+ if (windowContextId == null)
+ {
+ windowContextId = createNewWindowContextId();
}
- return getWindowContext(windowContextId);
+ windowContext = getWindowContext(windowContextId);
+
+ RequestCache.setCurrentWindowContext(windowContext);
+
+ return windowContext;
}
private synchronized String createNewWindowContextId()
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/RequestCache.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/RequestCache.java?rev=984635&r1=984634&r2=984635&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/RequestCache.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/RequestCache.java Thu Aug 12 02:57:23 2010
@@ -20,6 +20,7 @@ package org.apache.myfaces.extensions.cd
import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager;
import org.apache.myfaces.extensions.cdi.core.impl.utils.CodiUtils;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext;
import org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.spi.ConversationKey;
import org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.spi.EditableConversation;
@@ -32,7 +33,7 @@ import java.util.HashMap;
*/
public class RequestCache
{
- private static ThreadLocal<String> windowIdCache = new ThreadLocal<String>();
+ private static ThreadLocal<WindowContext> windowContextCache = new ThreadLocal<WindowContext>();
private static ThreadLocal<WindowContextManager> windowContextManagerCache
= new ThreadLocal<WindowContextManager>();
@@ -51,8 +52,8 @@ public class RequestCache
windowContextManagerBeanCache.set(null);
windowContextManagerBeanCache.remove();
- windowIdCache.set(null);
- windowIdCache.remove();
+ windowContextCache.set(null);
+ windowContextCache.remove();
resetConversationCache();
}
@@ -111,14 +112,14 @@ public class RequestCache
return windowContextManagerBean;
}
- public static String getCurrentWindowId()
+ public static WindowContext getCurrentWindowContext()
{
- return windowIdCache.get();
+ return windowContextCache.get();
}
- public static void setCurrentWindowId(String windowId)
+ public static void setCurrentWindowContext(WindowContext windowContext)
{
- windowIdCache.set(windowId);
+ windowContextCache.set(windowContext);
}
public static EditableConversation getConversation(ConversationKey conversationKey)