openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1677356 - in /openwebbeans/trunk/webbeans-jsf: pom.xml src/main/java/org/apache/webbeans/jsf/JsfConversationService.java
Date Sat, 02 May 2015 22:19:22 GMT
Author: struberg
Date: Sat May  2 22:19:22 2015
New Revision: 1677356

URL: http://svn.apache.org/r1677356
Log:
OWB-1050 also get cid from the request

This is needed to support non-JSF conversations as well

Modified:
    openwebbeans/trunk/webbeans-jsf/pom.xml
    openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JsfConversationService.java

Modified: openwebbeans/trunk/webbeans-jsf/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf/pom.xml?rev=1677356&r1=1677355&r2=1677356&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jsf/pom.xml (original)
+++ openwebbeans/trunk/webbeans-jsf/pom.xml Sat May  2 22:19:22 2015
@@ -32,6 +32,10 @@
             <groupId>org.apache.openwebbeans</groupId>
             <artifactId>openwebbeans-impl</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.openwebbeans</groupId>
+            <artifactId>openwebbeans-web</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>junit</groupId>

Modified: openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JsfConversationService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JsfConversationService.java?rev=1677356&r1=1677355&r2=1677356&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JsfConversationService.java
(original)
+++ openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JsfConversationService.java
Sat May  2 22:19:22 2015
@@ -18,18 +18,18 @@
  */
 package org.apache.webbeans.jsf;
 
-import javax.servlet.http.HttpSession;
 
-import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.webbeans.spi.ConversationService;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.web.context.WebConversationService;
 
-public class JsfConversationService implements ConversationService
+public class JsfConversationService extends WebConversationService
 {
-    private static final String ATTRIBUTE_NAME_CONVERSATION_ID_COUNTER = "owb_coversationId_counter";
-
-    private AtomicInteger conversationIdCounter = new AtomicInteger(0);
 
+    public JsfConversationService(WebBeansContext webBeansContext)
+    {
+        super(webBeansContext);
+    }
 
     @Override
     public String getConversationId()
@@ -37,27 +37,19 @@ public class JsfConversationService impl
         String conversationId = JSFUtil.getConversationId();
         if (conversationId == null || conversationId.length() == 0)
         {
+            // try to get the conversationId from the servlet
+            conversationId = super.getConversationId();
+        }
+        if (conversationId == null || conversationId.length() == 0)
+        {
             return null;
         }
-        return conversationId;
-    }
-
-    @Override
-    public String generateConversationId()
-    {
-        HttpSession session = JSFUtil.getSession();
-        if(session != null)
+        if ("none".equals(JSFUtil.getConversationPropagation()))
         {
-            AtomicInteger convIdCounter = (AtomicInteger) session.getAttribute(ATTRIBUTE_NAME_CONVERSATION_ID_COUNTER);
-            if (convIdCounter == null)
-            {
-                convIdCounter = new AtomicInteger(0);
-                session.setAttribute(ATTRIBUTE_NAME_CONVERSATION_ID_COUNTER, convIdCounter);
-            }
-
-            return Long.toString(convIdCounter.incrementAndGet());
+            // explicit 'blocking' of conversationPropagation
+            return null;
         }
-        
-        return "inMem_" + conversationIdCounter.incrementAndGet();
+        return conversationId;
     }
+
 }



Mime
View raw message