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 void removeEntry(String sid) { SessionInfo si = sessionTracker.remove(sid); if (si != null && si.getLoginName() != null) { CounterHelper.decreaseCounter(SESSION_COUNTER); } }
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; }
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; }