Repository: incubator-unomi
Updated Branches:
  refs/heads/master b55a20b72 -> cae1d4a60


UNOMI-103 : Add parameter in context servlet to invalidate session or profile


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/cae1d4a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/cae1d4a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/cae1d4a6

Branch: refs/heads/master
Commit: cae1d4a60248d242138f6a85403c2e75655b28b9
Parents: b55a20b
Author: rizak <rizak.ah...@gmail.com>
Authored: Tue Jun 20 13:49:33 2017 +0200
Committer: rizak <rizak.ah...@gmail.com>
Committed: Tue Jun 20 13:49:33 2017 +0200

----------------------------------------------------------------------
 wab/src/main/java/org/apache/unomi/web/ContextServlet.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/cae1d4a6/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
----------------------------------------------------------------------
diff --git a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java 
b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
index 61f36a3..ad70c18 100644
--- a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
+++ b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java
@@ -111,6 +111,8 @@ public class ContextServlet extends HttpServlet {
         }
 
         String sessionId = request.getParameter("sessionId");
+        boolean invalidateSession = 
request.getParameter("invalidateSession")!=null?new 
Boolean(request.getParameter("invalidateSession")):false;
+        boolean invalidateProfile = 
request.getParameter("invalidateProfile")!=null?new 
Boolean(request.getParameter("invalidateProfile")):false;
 
         if (cookieProfileId == null && sessionId == null && personaId == null) 
{
             
((HttpServletResponse)response).sendError(HttpServletResponse.SC_BAD_REQUEST);
@@ -142,8 +144,8 @@ public class ContextServlet extends HttpServlet {
             boolean profileCreated = false;
 
             // Not a persona, resolve profile now
-            if (cookieProfileId == null) {
-                // no profileId cookie was found, we generate a new one and 
create the profile in the profile service
+            if (cookieProfileId == null || invalidateProfile) {
+                // no profileId cookie was found or the profile has to be 
invalidated, we generate a new one and create the profile in the profile service
                 profile = createNewProfile(null, response, timestamp);
                 profileCreated = true;
             } else {
@@ -195,7 +197,7 @@ public class ContextServlet extends HttpServlet {
                 }
             }
 
-            if (session == null) {
+            if (session == null || invalidateSession) {
                 sessionProfile = 
privacyService.isRequireAnonymousBrowsing(profile.getItemId()) ? 
privacyService.getAnonymousProfile(profile) : profile;
                 session = new Session(sessionId, sessionProfile, timestamp, 
scope);
 

Reply via email to