类 SessionManagerOperations
java.lang.Object
cn.taketoday.session.SessionManagerOperations
SessionManager
- 从以下版本开始:
- 2021/4/30 23:01
- 作者:
- Harry Yang
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明getAttribute(WebSession session, String name) Get the value of the attribute identified byname.getAttribute(RequestContext context, String name) getSession(RequestContext context) Returns the current session associated with this request, or if the request does not have a session, creates one.getSession(RequestContext context, boolean create) Returns the currentWebSessionassociated with this request or, if there is no current session andcreateis true, returns a new session.final SessionManagerremoveAttribute(RequestContext context, String name) Remove the attribute identified bynameand return its value.voidsetAttribute(RequestContext context, String name, Object attribute) Set the attribute defined bynameto the suppliedvalue.
-
字段详细资料
-
sessionManager
-
-
构造器详细资料
-
SessionManagerOperations
-
-
方法详细资料
-
getSessionManager
-
getSession
Returns the current session associated with this request, or if the request does not have a session, creates one.- 参数:
context- Current request- 返回:
- the
WebSessionassociated with this request - 另请参阅:
-
getSession
Returns the currentWebSessionassociated with this request or, if there is no current session andcreateis true, returns a new session.If
createisfalseand the request has no validWebSession, this method returnsnull.To make sure the session is properly maintained, you must call this method before the response is committed. If the container is using cookies to maintain session integrity and is asked to create a new session when the response is committed, an IllegalStateException is thrown.
- 参数:
context- Current requestcreate-trueto create a new session for this request if necessary;falseto returnnullif there's no current session- 返回:
- the
WebSessionassociated with this request ornullifcreateisfalseand the request has no valid session - 另请参阅:
-
getAttribute
Get the value of the attribute identified byname. Returnnullif the attribute doesn't exist.- 参数:
name- the unique attribute key- 返回:
- the current value of the attribute, if any
-
getAttribute
-
setAttribute
Set the attribute defined bynameto the suppliedvalue. Ifvalueisnull, the attribute isremoved.In general, users should take care to prevent overlaps with other metadata attributes by using fully-qualified names, perhaps using class or package names as prefix.
- 参数:
name- the unique attribute keyattribute- the attribute value to be attached- 从以下版本开始:
- 4.0
-
removeAttribute
Remove the attribute identified bynameand return its value. Returnnullif no attribute undernameis found.- 参数:
name- the unique attribute key- 返回:
- the last value of the attribute, if any
- 从以下版本开始:
- 4.0
-