forked from fanruan/finekit
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
package com.fanruan.api.session; |
|
|
|
import com.fr.stable.script.NameSpace; |
|
import com.fr.stable.web.SessionProvider; |
|
import com.fr.web.core.ReportSessionIDInfor; |
|
import com.fr.web.core.SessionPoolManager; |
|
import com.fr.web.session.SessionIDInfo; |
|
import com.fr.web.utils.WebUtils; |
|
import org.jetbrains.annotations.NotNull; |
|
import org.jetbrains.annotations.Nullable; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
import java.util.Map; |
|
|
|
/** |
|
* @author richie |
|
* @version 10.0 |
|
* Created by richie on 2019-08-09 |
|
*/ |
|
public class SessionKit { |
|
|
|
/** |
|
* 根据sessionID信息返回会话对象 |
|
* @param sessionID 会话唯一标识符 |
|
* @return 会话对象 |
|
*/ |
|
public static @Nullable SessionProvider getSession(@NotNull String sessionID) { |
|
return SessionPoolManager.getSessionIDInfor(sessionID, SessionProvider.class); |
|
} |
|
|
|
/** |
|
* 生成一个关于回话的用于计算的名字空间 |
|
* @param sessionId 会话ID |
|
* @return 名字空间 |
|
* */ |
|
public static NameSpace asNameSpace(String sessionId) { |
|
return SessionIDInfo.asNameSpace(sessionId); |
|
} |
|
|
|
/** |
|
* 将HTTPServletRequest中的所有参数都读取出来,存储在一个Map中,返回出去 |
|
* @param req 请求 |
|
* @return 参数的map |
|
* */ |
|
public static Map<String, Object> parameters4SessionIDInfor(HttpServletRequest req){ |
|
return WebUtils.parameters4SessionIDInfor(req); |
|
} |
|
}
|
|
|