Class WrappedPortletSession

    • Constructor Detail

      • WrappedPortletSession

        public WrappedPortletSession​(javax.portlet.PortletSession session)
        Creates a new wrapped portlet session.
        Parameters:
        session - the portlet session to wrap.
    • Method Detail

      • getAttribute

        public Object getAttribute​(String name,
                                   int scope)
        Returns the object bound with the specified name in this session, or null if no object is bound under the name in the given scope.
        Parameters:
        name - a string specifying the name of the object
        scope - session scope of this attribute
        Returns:
        the object with the specified name
        Throws:
        IllegalStateException - if this method is called on an invalidated session, or the scope is unknown to the container.
        IllegalArgumentException - if name is null.
        Since:
        7.6
        See Also:
        PortletSession.getAttribute(String, int), PortletSession.PORTLET_SCOPE, PortletSession.APPLICATION_SCOPE
      • setAttribute

        public void setAttribute​(String name,
                                 Object value,
                                 int scope)
        Binds an object to this session in the given scope, using the name specified. If an object of the same name in this scope is already bound to the session, that object is replaced.

        If the value is null, this has the same effect as calling removeAttribute().

        Parameters:
        name - the name to which the object is bound; this cannot be null.
        value - the object to be bound
        scope - session scope of this attribute
        Throws:
        IllegalStateException - if this method is called on a session which has been invalidated
        IllegalArgumentException - if name is null or scope is unknown to the container.
        Since:
        7.6
        See Also:
        PortletSession.setAttribute(String, Object, int), PortletSession.PORTLET_SCOPE, PortletSession.APPLICATION_SCOPE
      • getPortletSession

        public javax.portlet.PortletSession getPortletSession()
        Gets the wrapped PortletSession.
        Returns:
        the wrapped portlet session
      • getAttributeNames

        public Set<String> getAttributeNames​(int scope)
        Gets the current set of attribute names bound to this session in the given scope.
        Parameters:
        scope - session scope of the attribute names
        Returns:
        an unmodifiable set of the current attribute names in the given scope
        Since:
        7.6
        See Also:
        PortletSession.getAttributeNames()
      • removeAttribute

        public void removeAttribute​(String name,
                                    int scope)
        Removes the object bound with the specified name and the given scope from this session. If the session does not have an object bound with the specified name, this method does nothing.
        Parameters:
        name - the name of the object to be removed from this session
        scope - session scope of this attribute
        Throws:
        IllegalStateException - if this method is called on a session which has been invalidated
        IllegalArgumentException - if name is null.
        Since:
        7.6
        See Also:
        PortletSession.removeAttribute(String, int), PortletSession.PORTLET_SCOPE, PortletSession.APPLICATION_SCOPE