无关风月
2025-01-21 8f2abbbda6c87c59d0c2c5da9979e78ea38e74db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.dsh.guns.modular.system.util;
 
import javax.servlet.http.HttpSession;
 
/**
 * 非Controller中获取当前session的工具类
 *
 * @author fengshuonan
 * @date 2016年11月28日 上午10:24:31
 */
public class HttpSessionHolder {
 
    private static ThreadLocal<HttpSession> tl = new ThreadLocal<HttpSession>();
 
    public static void put(HttpSession s) {
        tl.set(s);
    }
 
    public static HttpSession get() {
        return tl.get();
    }
 
    public static void remove() {
        tl.remove();
    }
}