BinCatSession.java示例代码片段:
package com.anbai.sec.server.servlet;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;
import java.util.Enumeration;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* BinCat Session实现
*/
public class BinCatSession implements HttpSession {
private final String sessionID;
// Http请求Session对象
private final Map<String, Object> sessionMap = new ConcurrentHashMap<String, Object>();
public BinCatSession(String sessionID) {
this.sessionID = sessionID;
}
// 此处省略HttpSession接口中的大部分方法,仅保留几个示例方法...
public Object getAttribute(String name) {
return this.sessionMap.get(name);
}
public void setAttribute(String name, Object value) {
this.sessionMap.put(name, value);
}
}