?? contextmanager.java
字號(hào):
package com.neusoft.sso;
import java.util.Set;
import javax.servlet.ServletContext;
/**************************************************
* NAME : ContextManager.java
* HISTORY
* 2007-08-15 shanc 創(chuàng)建文件
* 注意:這個(gè)類是個(gè)包訪問(wèn)權(quán)限的類,使用Sso組件的程序員,不建議了解該類的具體結(jié)構(gòu)
*************************************************/
class ContextManager {
static boolean hasUser(ServletContext context,String paraName){
//獲取其他所有平臺(tái)的context,并遍歷其中的Set
String[] otherNames = Global.getOthersNames();
for(int i = 0;i<otherNames.length;i++){
String otherName = otherNames[i];
ServletContext otherC = context.getContext("/"+otherName);
Set ssoUserSet = (Set)otherC.getAttribute(Global.SET_NAME);
if(ssoUserSet.contains(paraName))//已在別的應(yīng)用中登錄
return true;
}
return false;
}
static void clearContext(ServletContext context,String paraName){
//獲取自身平臺(tái)的Set,并清除Set中的paraName
Set selfUserSet = (Set)context.getAttribute(Global.SET_NAME);
selfUserSet.remove(paraName);
//獲取其他所有平臺(tái)的context,并清除Set中的paraName
String[] otherNames = Global.getOthersNames();
for(int i = 0;i<otherNames.length;i++){
String otherName = otherNames[i];
ServletContext otherC = context.getContext("/"+otherName);
Set ssoUserSet = (Set)otherC.getAttribute(Global.SET_NAME);
ssoUserSet.remove(paraName);
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -