Reuse data sessions.
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / http / CmsSessionProvider.java
index a1ddcb0babb26315ac569bf0297e03f7094e6a43..a6ed7d884f43fd862476d44d2a213b981b883efc 100644 (file)
@@ -35,9 +35,11 @@ public class CmsSessionProvider implements SessionProvider, Serializable {
        public Session getSession(HttpServletRequest request, Repository rep, String workspace)
                        throws javax.jcr.LoginException, ServletException, RepositoryException {
 
+               // a client is scanning parent URLs.
+//             if (workspace == null)
+//                     return null;
+
                CmsSessionImpl cmsSession = WebCmsSessionImpl.getCmsSession(request);
-               // if (cmsSession == null)
-               // return anonymousSession(request, rep, workspace);
                if (log.isTraceEnabled()) {
                        log.trace("Get JCR session from " + cmsSession);
                }
@@ -46,30 +48,8 @@ public class CmsSessionProvider implements SessionProvider, Serializable {
                return session;
        }
 
-       // private synchronized Session anonymousSession(HttpServletRequest request,
-       // Repository repository, String workspace) {
-       // // TODO rather log in here as anonymous?
-       // LoginContext lc = (LoginContext)
-       // request.getAttribute(NodeConstants.LOGIN_CONTEXT_ANONYMOUS);
-       // if (lc == null)
-       // throw new CmsException("No login context available");
-       // // optimize
-       // Session session;
-       // try {
-       // session = Subject.doAs(lc.getSubject(), new
-       // PrivilegedExceptionAction<Session>() {
-       // @Override
-       // public Session run() throws Exception {
-       // return repository.login(workspace);
-       // }
-       // });
-       // } catch (Exception e) {
-       // throw new CmsException("Cannot log in to JCR", e);
-       // }
-       // return session;
-       // }
-
-       public synchronized void releaseSession(Session session) {
+       public void releaseSession(Session session) {
+//             JcrUtils.logoutQuietly(session);
                if (cmsSessions.containsKey(session)) {
                        CmsSessionImpl cmsSession = cmsSessions.get(session);
                        cmsSession.releaseDataSession(alias, session);