类 SessionScope

    • 构造器详细资料

      • SessionScope

        public SessionScope()
        Create a new SessionScope, storing attributes in a locally isolated session (or default session, if there is no distinction between a global session and a component-specific session).
      • SessionScope

        public SessionScope​(boolean globalSession)
        Create a new SessionScope, specifying whether to store attributes in the global session, provided that such a distinction is available.

        This distinction is important for Portlet environments, where there are two notions of a session: "portlet scope" and "application scope". If this flag is on, objects will be put into the "application scope" session; else they will end up in the "portlet scope" session (the typical default).

        In a Servlet environment, this flag is effectively ignored.

        参数:
        globalSession - true in case of the global session as target; false in case of a component-specific session as target
        另请参阅:
        PortletRequestAttributes, ServletRequestAttributes
    • 方法详细资料

      • getConversationId

        public String getConversationId()
        从接口复制的说明: Scope
        Return the conversation ID for the current underlying scope, if any.

        The exact meaning of the conversation ID depends on the underlying storage mechanism. In the case of session-scoped objects, the conversation ID would typically be equal to (or derived from) the session ID; in the case of a custom conversation that sits within the overall session, the specific ID for the current conversation would be appropriate.

        Note: This is an optional operation. It is perfectly valid to return null in an implementation of this method if the underlying storage mechanism has no obvious candidate for such an ID.

        返回:
        the conversation ID, or null if there is no conversation ID for the current scope
      • get

        public Object get​(String name,
                          ObjectFactory<?> objectFactory)
        从接口复制的说明: Scope
        Return the object with the given name from the underlying scope, creating it if not found in the underlying storage mechanism.

        This is the central operation of a Scope, and the only operation that is absolutely required.

        指定者:
        get 在接口中 Scope
        覆盖:
        get 在类中 AbstractRequestAttributesScope
        参数:
        name - the name of the object to retrieve
        objectFactory - the ObjectFactory to use to create the scoped object if it is not present in the underlying storage mechanism
        返回:
        the desired object (never null)
      • remove

        public Object remove​(String name)
        从接口复制的说明: Scope
        Remove the object with the given name from the underlying scope.

        Returns null if no object was found; otherwise returns the removed Object.

        Note that an implementation should also remove a registered destruction callback for the specified object, if any. It does, however, not need to execute a registered destruction callback in this case, since the object will be destroyed by the caller (if appropriate).

        Note: This is an optional operation. Implementations may throw UnsupportedOperationException if they do not support explicitly removing an object.

        指定者:
        remove 在接口中 Scope
        覆盖:
        remove 在类中 AbstractRequestAttributesScope
        参数:
        name - the name of the object to remove
        返回:
        the removed object, or null if no object was present
        另请参阅:
        Scope.registerDestructionCallback(java.lang.String, java.lang.Runnable)