public class HttpSession extends Attributes
Constructor and Description |
---|
HttpSession(WebServerConfig config,
SessionManager sessionManager,
IoSession socketSession)
构造函数
|
Modifier and Type | Method and Description |
---|---|
void |
attach(HttpRequest request,
HttpResponse response)
绑定当前 Session 到一个 http 请求响应对
|
void |
close()
关闭会话对象
|
String |
getId()
获取 Session ID
|
int |
getMaxInactiveInterval()
获取最大不活动时间
|
protected SessionManager |
getSessionManager()
获取 Session 管理器
|
IoSession |
getSocketSession()
获取 socket 会话对象
|
void |
init(SessionManager sessionManager,
IoSession socketSession)
用于从会话池中取出的会话实例化
|
HttpSession |
refresh()
刷新 Session 的超时时间
|
void |
release()
释放 Session
|
void |
save()
保存 Session
|
void |
setMaxInactiveInterval(int maxInactiveInterval)
设置最大不活动时间
|
protected void |
setSessionManager(SessionManager sessionManager)
设置Session 管理器
|
void |
setSocketSession(IoSession socketSession)
设置 socket 会话对象
|
attributes, clearAttribute, containAttribute, getAttribute, isModifyed, removeAttribute, setAttribute, setModifyed
public HttpSession(WebServerConfig config, SessionManager sessionManager, IoSession socketSession)
config
- WEB服务配置对象sessionManager
- Session管理器socketSession
- Socket会话对象public void init(SessionManager sessionManager, IoSession socketSession)
sessionManager
- Session管理器socketSession
- Socket会话对象public IoSession getSocketSession()
public void setSocketSession(IoSession socketSession)
socketSession
- socket 会话对象public HttpSession refresh()
protected SessionManager getSessionManager()
protected void setSessionManager(SessionManager sessionManager)
sessionManager
- Session 管理器public String getId()
public int getMaxInactiveInterval()
public void setMaxInactiveInterval(int maxInactiveInterval)
maxInactiveInterval
- 最大不活动时间, 单位: 毫秒public void save()
public void release()
public void attach(HttpRequest request, HttpResponse response)
request
- 请求对象response
- 响应对象public void close()
Copyright © 2020 Voovan. All rights reserved.