|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.tinygroup.weblayer.webcontext.session.impl.SessionImpl
public class SessionImpl
实现了HttpSession接口。
注意,每个request均会创建独立的session对象,此对象本身不是线程安全的,不能被多线程同时访问。但其后备的session store是线程安全的。
| 构造方法摘要 | |
|---|---|
SessionImpl(String sessionID,
SessionWebContext webContext,
boolean isNew,
boolean create)
创建一个session对象。 |
|
| 方法摘要 | |
|---|---|
protected void |
assertAttributeNameForModification(String methodName,
String attrName)
检查将要更改的attr name是否合法。 |
protected void |
assertModel(String methodName)
确保model已经被取得,即session已被初始化。 |
protected void |
assertValid(String methodName)
确保session处于valid状态。 |
void |
clear()
清除一个session。 |
void |
commit(boolean commitHeaders)
提交session的内容,删除的、新增的、修改的内容被保存。 |
Object |
getAttribute(String name)
取得指定名称的attribute值。 |
Enumeration<String> |
getAttributeNames()
取得所有attributes的名称。 |
long |
getCreationTime()
取得session的创建时间。 |
String |
getId()
取得session ID。 |
long |
getLastAccessedTime()
取得最近访问时间。 |
int |
getMaxInactiveInterval()
取得session的最大不活动期限,超过此时间,session就会失效。 |
javax.servlet.ServletContext |
getServletContext()
取得当前session所属的servlet context。 |
javax.servlet.http.HttpSessionContext |
getSessionContext()
已过时。 no replacement |
SessionModel |
getSessionModel()
取得当前的model。 |
SessionWebContext |
getSessionWebContext()
取得创建该session的request context。 |
Object |
getValue(String name)
已过时。 use getAttribute instead |
String[] |
getValueNames()
已过时。 use getAttributeNames instead |
void |
invalidate()
使一个session作废。 |
boolean |
isInvalidated()
判断当前session是否非法。 |
boolean |
isNew()
当前session是否为新的? |
void |
putValue(String name,
Object value)
已过时。 use setAttribute instead |
void |
removeAttribute(String name)
删除一个attribute。 |
void |
removeValue(String name)
已过时。 use removeAttribute instead |
void |
setAttribute(String name,
Object value)
设置指定名称的attribute值。 |
void |
setMaxInactiveInterval(int maxInactiveInterval)
设置session的最大不活动期限,超过此时间,session就会失效。 |
String |
toString()
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 构造方法详细信息 |
|---|
public SessionImpl(String sessionID,
SessionWebContext webContext,
boolean isNew,
boolean create)
| 方法详细信息 |
|---|
public SessionWebContext getSessionWebContext()
public SessionModel getSessionModel()
public String getId()
javax.servlet.http.HttpSession 中的 getIdpublic long getCreationTime()
javax.servlet.http.HttpSession 中的 getCreationTimeIllegalStateException - 如果session已经invalidatedpublic long getLastAccessedTime()
javax.servlet.http.HttpSession 中的 getLastAccessedTimeIllegalStateException - 如果session已经invalidatedpublic int getMaxInactiveInterval()
javax.servlet.http.HttpSession 中的 getMaxInactiveIntervalpublic void setMaxInactiveInterval(int maxInactiveInterval)
javax.servlet.http.HttpSession 中的 setMaxInactiveIntervalmaxInactiveInterval - 不活动期限的秒数public javax.servlet.ServletContext getServletContext()
javax.servlet.http.HttpSession 中的 getServletContextServletContext对象public Object getAttribute(String name)
javax.servlet.http.HttpSession 中的 getAttributename - attribute名称
IllegalStateException - 如果session已经invalidatedpublic Enumeration<String> getAttributeNames()
javax.servlet.http.HttpSession 中的 getAttributeNamesIllegalStateException - 如果session已经invalidated
public void setAttribute(String name,
Object value)
javax.servlet.http.HttpSession 中的 setAttributename - attribute名称value - attribute的值
IllegalStateException - 如果session已经invalidated
IllegalArgumentException - 如果指定的attribute名称不被支持public void removeAttribute(String name)
javax.servlet.http.HttpSession 中的 removeAttributename - 要删除的attribute名称
IllegalStateException - 如果session已经invalidatedpublic void invalidate()
javax.servlet.http.HttpSession 中的 invalidateIllegalStateException - 如果session已经invalidatedpublic void clear()
IllegalStateException - 如果session已经invalidatedpublic boolean isInvalidated()
public boolean isNew()
javax.servlet.http.HttpSession 中的 isNewtrue
IllegalStateException - 如果session已经invalidatedprotected void assertModel(String methodName)
methodName - 当前正要执行的方法protected void assertValid(String methodName)
methodName - 当前正要执行的方法
protected void assertAttributeNameForModification(String methodName,
String attrName)
public void commit(boolean commitHeaders)
@Deprecated public javax.servlet.http.HttpSessionContext getSessionContext()
javax.servlet.http.HttpSession 中的 getSessionContext@Deprecated public Object getValue(String name)
javax.servlet.http.HttpSession 中的 getValue@Deprecated public String[] getValueNames()
javax.servlet.http.HttpSession 中的 getValueNames
@Deprecated
public void putValue(String name,
Object value)
javax.servlet.http.HttpSession 中的 putValue@Deprecated public void removeValue(String name)
javax.servlet.http.HttpSession 中的 removeValuepublic String toString()
Object 中的 toString
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||