@Factory(value = "userHttpSessions", scope = ScopeType.EVENT) public List<SessionInfo> getUserSessions() { if (getSelectedHttpSessionsTimeRange().equals("all")) { return NuxeoHttpSessionMonitor.instance().getSortedSessions(); } else { long maxInactivity = Long.parseLong(selectedHttpSessionsTimeRange.replace("s", "")); return NuxeoHttpSessionMonitor.instance().getSortedSessions(maxInactivity); } }
@Factory(value = "nbUserRequests", scope = ScopeType.EVENT) public long getUserRequestCount() { return NuxeoHttpSessionMonitor.instance().getGlobalRequestCounter(); }
@Override public void sessionDestroyed(HttpSessionEvent se) { NuxeoHttpSessionMonitor.instance().removeEntry(se.getSession().getId()); }
public void onAuthenticatedSessionCreated(ServletRequest request, HttpSession session, CachableUserIdentificationInfo cachebleUserInfo) { NuxeoHttpSessionMonitor.instance().associatedUser(session, cachebleUserInfo.getPrincipal().getName()); if (!sessionManagers.isEmpty()) { for (String smName : sessionManagers.keySet()) { NuxeoAuthenticationSessionManager sm = sessionManagers.get(smName); sm.onAuthenticatedSessionCreated(request, session, cachebleUserInfo); } } }
log.debug("userIdent found in cache, get the Principal from it without reloggin"); NuxeoHttpSessionMonitor.instance().updateEntry(httpRequest);
public SessionInfo updateEntry(HttpServletRequest request) { HttpSession session = request.getSession(false); if (session != null && session.getId() != null) { SessionInfo si = sessionTracker.get(session.getId()); if (si != null) { si.updateLastAccessTime(); si.setLastAccessUrl(request.getRequestURI()); increaseRequestCounter(); return si; } else { return addEntry(session); } } return null; }
public List<SessionInfo> getSortedSessions() { List<SessionInfo> sortedSessions = new ArrayList<SessionInfo>(); for (SessionInfo si : getTrackedSessions()) { if (si.getLoginName() != null) { sortedSessions.add(si); } } Collections.sort(sortedSessions); return sortedSessions; }
public SessionInfo associatedUser(HttpSession session, String userName) { if (session == null || session.getId() == null) { return null; } SessionInfo si = sessionTracker.get(session.getId()); if (si == null) { si = addEntry(session); } if (si.getLoginName() == null) { si.setLoginName(userName); CounterHelper.increaseCounter(SESSION_COUNTER); } return si; }
public SessionInfo associatedUser(HttpServletRequest request) { HttpSession session = request.getSession(false); if (session != null && session.getId() != null) { SessionInfo si = sessionTracker.get(session.getId()); if (si == null) { si = addEntry(session); } if (request.getUserPrincipal() != null && si.getLoginName() == null) { si.setLoginName(request.getUserPrincipal().getName()); CounterHelper.increaseCounter(SESSION_COUNTER); } si.setLastAccessUrl(request.getRequestURI()); increaseRequestCounter(); return si; } return null; }
public List<SessionInfo> getSortedSessions(long maxInactivity) { List<SessionInfo> sortedSessions = new ArrayList<SessionInfo>(); for (SessionInfo si : getTrackedSessions()) { if (si.getLoginName() != null && si.getInactivityInS() < maxInactivity) { sortedSessions.add(si); } } Collections.sort(sortedSessions); return sortedSessions; }
@Factory(value = "userHttpSessions", scope = ScopeType.EVENT) public List<SessionInfo> getUserSessions() { if (getSelectedHttpSessionsTimeRange().equals("all")) { return NuxeoHttpSessionMonitor.instance().getSortedSessions(); } else { long maxInactivity = Long.parseLong(selectedHttpSessionsTimeRange.replace("s", "")); return NuxeoHttpSessionMonitor.instance().getSortedSessions(maxInactivity); } }
@Factory(value = "nbUserRequests", scope = ScopeType.EVENT) public long getUserRequestCount() { return NuxeoHttpSessionMonitor.instance().getGlobalRequestCounter(); }
@Factory(value = "nbActiveUserHttpSessions", scope = ScopeType.EVENT) public int getUserSessionsCount() { return NuxeoHttpSessionMonitor.instance().getSortedSessions().size(); }
@Factory(value = "nbActiveUserHttpSessions", scope = ScopeType.EVENT) public int getUserSessionsCount() { return NuxeoHttpSessionMonitor.instance().getSortedSessions().size(); }