类 SessionScope
java.lang.Object
cn.taketoday.web.context.support.AbstractRequestContextScope<WebSession>
cn.taketoday.web.context.support.SessionScope
- 所有已实现的接口:
cn.taketoday.beans.factory.config.Scope
Session-backed
Scope implementation.
Relies on a thread-bound RequestContext instance
- 从以下版本开始:
- 4.0 2022/2/21 11:40
- 作者:
- Rod Johnson, Juergen Hoeller, Rob Harrop, Harry Yang
- 另请参阅:
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明static final StringConstant identifying theStringprefixed to the name of a destruction callback when it is stored in aWebSession.private final SessionManagerDiscover从接口继承的字段 cn.taketoday.beans.factory.config.Scope
PROTOTYPE, SINGLETON -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static WebSessionAttributeListenerprotected ObjectgetAttribute(WebSession context, String beanName) private static Stringprivate WebSessiongetSession(RequestContext context) Returns the current session associated with this request, or if the request does not have a session, creates one.private WebSessiongetSession(RequestContext request, boolean create) Returns the currentWebSessionassociated with this request or, if there is no current session andcreateis true, returns a new session.voidregisterDestructionCallback(String name, Runnable callback) protected voidremoveAttribute(WebSession context, String name) protected voidsetAttribute(WebSession context, String beanName, Object scopedObject) 从类继承的方法 cn.taketoday.web.context.support.AbstractRequestContextScope
doGetBean, remove
-
字段详细资料
-
DESTRUCTION_CALLBACK_NAME_PREFIX
Constant identifying theStringprefixed to the name of a destruction callback when it is stored in aWebSession. -
sessionManagerDiscover
-
-
构造器详细资料
-
SessionScope
public SessionScope(cn.taketoday.beans.factory.BeanFactory beanFactory)
-
-
方法详细资料
-
getConversationId
-
get
-
remove
-
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.
- 参数:
request- 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 - 另请参阅:
-
setAttribute
-
getAttribute
-
removeAttribute
-
resolveContextualObject
-
registerDestructionCallback
-
getDestructionCallbackName
-
createDestructionCallback
-