package com.uas.platform.b2b.manage.core.support;

import com.uas.platform.b2b.manage.model.User;

import javax.servlet.http.HttpSession;

/**
 * 每次请求服务器时，用户信息存放在本次线程中
 * 
 * @author yingp
 * 
 */
public class SystemSession {

	private static ThreadLocal<User> local = new ThreadLocal<>();

	private static User user;

	private static ThreadLocal<HttpSession> localSession = new ThreadLocal<>();

	public static void setUser(User session) {
		local.set(session);
	}

	public static User getUser() {
		return local.get();
	}

	public static void clear() {
		local.remove();
	}

    public static void setSession(HttpSession session) {
		localSession.set(session);
    }
}
