-
- // TODO optimize
- String pathInfo = request.getPathInfo();
- List<String> tokens = JcrUtils.tokenize(pathInfo);
- if (currentRepositoryName == null)
- currentRepositoryName = tokens.get(0);
- else if (!currentRepositoryName.equals(tokens.get(0))
- || !currentWorkspaceName.equals(workspace)) {
- JcrUtils.logoutQuietly(jcrSession);
- jcrSession = null;
- if (log.isDebugEnabled())
- log.debug(getHttpSessionId()
- + " Changed repository or workspace, logging out of "
- + currentWorkspaceName);
- }
+ if (currentJcrUser == null)
+ currentJcrUser = springUser;
+
+ if (jcrSession != null)
+ if (!currentRepositoryName.equals(httpRepository)) {
+ if (log.isDebugEnabled())
+ log.debug(getHttpSessionId() + " Changed from repository "
+ + currentRepositoryName + " to " + httpRepository
+ + ", logging out.");
+ logout();
+ } else if (!currentWorkspaceName.equals(workspace)) {
+ if (log.isDebugEnabled())
+ log.debug(getHttpSessionId() + " Changed from workspace "
+ + currentWorkspaceName + " to " + workspace
+ + ", logging out.");
+ logout();
+ } else if (!currentJcrUser.equals(springUser)) {
+ if (log.isDebugEnabled())
+ log.debug(getHttpSessionId() + " Changed from user "
+ + currentJcrUser + " to " + springUser
+ + ", logging out.");
+ logout();
+ }