001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package coldfusion.runtime; 020 021import lucee.runtime.CFMLFactoryImpl; 022import lucee.runtime.PageContext; 023import lucee.runtime.engine.ThreadLocalPageContext; 024import lucee.runtime.type.Struct; 025import lucee.runtime.type.scope.ScopeContext; 026 027public class SessionTracker { 028 029 /* 030 * prepare to restrict access to this class 031 * private String webAdminPassword; 032 033 public SessionTracker(){ 034 throw new RuntimeException("for Security reasons we have restricted the usage of the class SessionTracker, " + 035 "you now can only use this class by defining the web admin password, when you call the constructor of this class, " + 036 "so instead of just doing the following: SessionTracker=createObject('java','coldfusion.runtime.SessionTracker') " + 037 "and then use it, you have to call the constructor with the web admin password: SessionTracker=createObject('java','coldfusion.runtime.SessionTracker').init('yourwebadminpassword')"); 038 039 040 } 041 public SessionTracker(String webAdminPassword) throws SAXException, IOException{ 042 this.webAdminPassword=webAdminPassword; 043 044 PageContext pc = ThreadLocalPageContext.get(); 045 //ConfigWebAdmin admin = ConfigWebAdmin.newInstance((ConfigWebImpl)pc.getConfig(),webAdminPassword); 046 // TODO verify password 047 }*/ 048 049 050 public static int getSessionCount(){ 051 PageContext pc = ThreadLocalPageContext.get(); 052 ScopeContext sc = ((CFMLFactoryImpl)pc.getCFMLFactory()).getScopeContext(); 053 return sc.getSessionCount(pc); 054 } 055 056 public static Struct getSessionCollection(String appName){ 057 PageContext pc = ThreadLocalPageContext.get(); 058 ScopeContext sc = ((CFMLFactoryImpl)pc.getCFMLFactory()).getScopeContext(); 059 return sc.getAllSessionScopes(appName); 060 } 061 062 /* 063 public static coldfusion.runtime.SessionScope getSession(java.lang.String,java.lang.String) 064 public static coldfusion.runtime.SessionScope getSession(java.lang.String) 065 public static coldfusion.runtime.SessionScope getSession(javax.servlet.http.HttpSession,java.lang.String) 066 public static coldfusion.runtime.SessionScope getSession(java.lang.String,java.lang.String,java.lang.String) 067 public static coldfusion.runtime.SessionScope createSession(java.lang.String,java.lang.String) 068 public static coldfusion.runtime.SessionScope createSession(java.lang.String,java.lang.String,java.lang.String) 069 public static coldfusion.runtime.SessionScope createSession(javax.servlet.http.HttpSession,java.lang.String) 070 public static void cleanUp(java.lang.String,java.lang.String,java.lang.String) 071 public static void cleanUp(javax.servlet.http.HttpSession,java.lang.String) 072 public static void cleanUp(java.lang.String,java.lang.String) 073 public static java.util.Enumeration getSessionKeys() 074 public static java.util.Hashtable getMSessionPool() 075 public static coldfusion.runtime.AppSessionCollection getSessionCollection(java.lang.String) 076 */ 077 078 079}