Overview  Package   Class  Tree  Serialized  Deprecated  Index  Help 

org.apache.jetspeed.portlet
Interface PortletSession

All Superinterfaces:
javax.servlet.http.HttpSession

public interface PortletSession
extends javax.servlet.http.HttpSession

The PortletSession holds the user-specific data that the portlet needs to personalize the one global portlet instance. Together with the portlet, the portlet session constitutes the concrete portlet instance.

Note: The invalidate method inherited from the HttpSession interface exhibits a different behavior for a portlet session. It removes all session attributes of the portlet and calls the PortletSessionListener.logout method, but does not actually invalidate the session object; later access to the session is not guaranteed to cause an exception. Within the same user session, the login and logout methods of the portlet will not be called again, even if a new PortletSession is created. It is recommended not to use the invalidate method on a portlet session.

Since:
4.1
See Also:
Portlet

Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Returns the value of the attribute with the given name, or null if no attribute with the given name exists.
 java.util.Enumeration getAttributeNames()
          Returns an enumeration of names of all attributes available to this session.
 long getCreationTime()
          Returns the point of time that this session was created.
 long getLastAccessedTime()
          Returns the point of time that this session was last accessed.
 org.apache.jetspeed.portlet.User getUser()
          Deprecated. use portletRequest.getUser() since version 1.1
 void removeAttribute(java.lang.String name)
          Removes the attribute with the given name.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Associates an attribute with the given name and value with this session.
 

Methods inherited from interface javax.servlet.http.HttpSession
getId, getMaxInactiveInterval, getServletContext, getSessionContext, getValue, getValueNames, invalidate, isNew, putValue, removeValue, setMaxInactiveInterval
 

Method Detail

getUser

public org.apache.jetspeed.portlet.User getUser()
Deprecated. use portletRequest.getUser() since version 1.1

Returns the user object. The user object contains useful information about the user and his or her preferences.

If the user has not logged in or does not grant access to the portlet, this method returns null.

Returns:
the user object

getCreationTime

public long getCreationTime()
Returns the point of time that this session was created. Essentially, this will also be the time when the user logged in. The time is returned as the number of milliseconds since January 1, 1970 GMT.

Specified by:
getCreationTime in interface javax.servlet.http.HttpSession
Returns:
the time of creation

getLastAccessedTime

public long getLastAccessedTime()
Returns the point of time that this session was last accessed. The time is returned as the number of milliseconds since January 1, 1970 GMT.

Specified by:
getLastAccessedTime in interface javax.servlet.http.HttpSession
Returns:
the time of the last access

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Associates an attribute with the given name and value with this session. If a portlet needs to communicate information to embedded servlets or JSP, this methods can used carry the information along.

The portlet provider should take care that the the namespace of attribute names is not unnecessarily polluted. It is recommended to prefix all attributes the package and class name of the portlet that makes use of this method.

Specified by:
setAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - the attribute name
value - the attribute value

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the value of the attribute with the given name, or null if no attribute with the given name exists.

Specified by:
getAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - the attribute name
Returns:
the attribute value

getAttributeNames

public java.util.Enumeration getAttributeNames()
Returns an enumeration of names of all attributes available to this session. This method returns an empty enumeration if the session has no attributes available to it.

Specified by:
getAttributeNames in interface javax.servlet.http.HttpSession
Returns:
an enumeration of attribute names

removeAttribute

public void removeAttribute(java.lang.String name)
Removes the attribute with the given name.

Specified by:
removeAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - the name of attribute to be removed

Overview  Package   Class  Tree  Serialized  Deprecated  Index  Help 

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.