Session接口

Session接口主要定义了会话信息,先对其解析如下:

1.获取sessionId

Serializable getId();

2.获取起始时间

Date getStartTimestamp();

3.获取最后的访问时间

Date getLastAccessTime();

4.获取超时时间

long getTimeout() throws InvalidSessionException;

5.设置超时时间

void setTimeout(long maxIdleTimeInMillis) throws InvalidSessionException;

6.获取主机名字或者主机ip地址

String getHost();

7.更新最后访问时间

void touch() throws InvalidSessionException;

8.暂停session,并释放所有资源

void stop() throws InvalidSessionException;

9.返回session下所有属性的键值集合

Collection<Object> getAttributeKeys() throws InvalidSessionException;

10.根据键获取session下属性的值

Object getAttribute(Object key) throws InvalidSessionException;

11.设置session下属性值

void setAttribute(Object key, Object value) throws InvalidSessionException;

12.移除session下的属性

Object removeAttribute(Object key) throws InvalidSessionException;

猜你喜欢

转载自yansxjl.iteye.com/blog/2334584
今日推荐