org.apache.pluto.internal.impl
Class PortletSessionImpl

java.lang.Object
  extended by org.apache.pluto.internal.impl.PortletSessionImpl
All Implemented Interfaces:
javax.portlet.PortletSession, javax.servlet.http.HttpSession

public class PortletSessionImpl
extends java.lang.Object
implements javax.portlet.PortletSession, javax.servlet.http.HttpSession

Implementation of the javax.portlet.PortletSession interface.


Field Summary
protected static int DEFAULT_SCOPE
          The default scope (PORTLET_SCOPE) for storing objects.
protected static char ID_NAME_SEPARATOR
          The portlet window ID / attribute name separator as defined in PLT.
protected static java.lang.String PORTLET_SCOPE_NAMESPACE
          The portlet scope namespace as defined in PLT.
 
Fields inherited from interface javax.portlet.PortletSession
APPLICATION_SCOPE, PORTLET_SCOPE
 
Constructor Summary
PortletSessionImpl(javax.portlet.PortletContext portletContext, InternalPortletWindow internalPortletWindow, javax.servlet.http.HttpSession httpSession)
          Constructs an instance.
 
Method Summary
protected  java.lang.String createPortletScopedId(java.lang.String name)
          Creates portlet-scoped ID for the specified attribute name.
 java.lang.Object getAttribute(java.lang.String name)
           
 java.lang.Object getAttribute(java.lang.String name, int scope)
          Returns the attribute of the specified name under the given scope.
 java.util.Enumeration getAttributeNames()
           
 java.util.Enumeration getAttributeNames(int scope)
           
 long getCreationTime()
           
 java.lang.String getId()
           
 long getLastAccessedTime()
           
 int getMaxInactiveInterval()
           
 javax.portlet.PortletContext getPortletContext()
           
 javax.servlet.ServletContext getServletContext()
           
 javax.servlet.http.HttpSessionContext getSessionContext()
          Deprecated.  
 java.lang.Object getValue(java.lang.String name)
           
 java.lang.String[] getValueNames()
          Deprecated.  
 void invalidate()
           
protected  boolean isInCurrentPortletScope(java.lang.String name)
          Checks if the attribute name in APPLICATION_SCOPE is in the current portlet scope.
 boolean isNew()
           
 void putValue(java.lang.String name, java.lang.Object value)
           
 void removeAttribute(java.lang.String name)
           
 void removeAttribute(java.lang.String name, int scope)
           
 void removeValue(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 void setAttribute(java.lang.String name, java.lang.Object value, int scope)
           
 void setMaxInactiveInterval(int interval)
          Specifies the time, in seconds, between client requests, before the portlet container invalidates this session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SCOPE

protected static final int DEFAULT_SCOPE
The default scope (PORTLET_SCOPE) for storing objects.

See Also:
Constant Field Values

PORTLET_SCOPE_NAMESPACE

protected static final java.lang.String PORTLET_SCOPE_NAMESPACE
The portlet scope namespace as defined in PLT. 15.3.

See Also:
Constant Field Values

ID_NAME_SEPARATOR

protected static final char ID_NAME_SEPARATOR
The portlet window ID / attribute name separator as defined in PLT. 15.3.

See Also:
Constant Field Values
Constructor Detail

PortletSessionImpl

public PortletSessionImpl(javax.portlet.PortletContext portletContext,
                          InternalPortletWindow internalPortletWindow,
                          javax.servlet.http.HttpSession httpSession)
Constructs an instance.

Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Specified by:
getAttribute in interface javax.portlet.PortletSession
Specified by:
getAttribute in interface javax.servlet.http.HttpSession

getAttribute

public java.lang.Object getAttribute(java.lang.String name,
                                     int scope)
Returns the attribute of the specified name under the given scope.

Specified by:
getAttribute in interface javax.portlet.PortletSession
Parameters:
name - the attribute name.
scope - the scope under which the attribute object is stored.
Returns:
the attribute object.

getAttributeNames

public java.util.Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface javax.portlet.PortletSession
Specified by:
getAttributeNames in interface javax.servlet.http.HttpSession

getAttributeNames

public java.util.Enumeration getAttributeNames(int scope)
Specified by:
getAttributeNames in interface javax.portlet.PortletSession

removeAttribute

public void removeAttribute(java.lang.String name)
Specified by:
removeAttribute in interface javax.portlet.PortletSession
Specified by:
removeAttribute in interface javax.servlet.http.HttpSession

removeAttribute

public void removeAttribute(java.lang.String name,
                            int scope)
Specified by:
removeAttribute in interface javax.portlet.PortletSession

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Specified by:
setAttribute in interface javax.portlet.PortletSession
Specified by:
setAttribute in interface javax.servlet.http.HttpSession

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value,
                         int scope)
Specified by:
setAttribute in interface javax.portlet.PortletSession

getPortletContext

public javax.portlet.PortletContext getPortletContext()
Specified by:
getPortletContext in interface javax.portlet.PortletSession

getCreationTime

public long getCreationTime()
Specified by:
getCreationTime in interface javax.portlet.PortletSession
Specified by:
getCreationTime in interface javax.servlet.http.HttpSession

getId

public java.lang.String getId()
Specified by:
getId in interface javax.portlet.PortletSession
Specified by:
getId in interface javax.servlet.http.HttpSession

getLastAccessedTime

public long getLastAccessedTime()
Specified by:
getLastAccessedTime in interface javax.portlet.PortletSession
Specified by:
getLastAccessedTime in interface javax.servlet.http.HttpSession

getMaxInactiveInterval

public int getMaxInactiveInterval()
Specified by:
getMaxInactiveInterval in interface javax.portlet.PortletSession
Specified by:
getMaxInactiveInterval in interface javax.servlet.http.HttpSession

invalidate

public void invalidate()
                throws java.lang.IllegalStateException
Specified by:
invalidate in interface javax.portlet.PortletSession
Specified by:
invalidate in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException

isNew

public boolean isNew()
              throws java.lang.IllegalStateException
Specified by:
isNew in interface javax.portlet.PortletSession
Specified by:
isNew in interface javax.servlet.http.HttpSession
Throws:
java.lang.IllegalStateException

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests, before the portlet container invalidates this session. A negative time indicates the session should never timeout.

[Portlet Spec. PLT. 15.4.] If the PortletSession object is invalidated by a portlet, the portlet container must invalidate the associated HttpSession object.

Specified by:
setMaxInactiveInterval in interface javax.portlet.PortletSession
Specified by:
setMaxInactiveInterval in interface javax.servlet.http.HttpSession
Parameters:
interval - an integer specifying the number of seconds.

createPortletScopedId

protected java.lang.String createPortletScopedId(java.lang.String name)
Creates portlet-scoped ID for the specified attribute name. Portlet-scoped ID for a given attribute name has the following form: javax.portlet.p.<ID>?<name> where ID is a unique identification for the portlet window (assigned by the portal/portlet-container) that must not contain a '?' character. name is the attribute name.

Refer to Portlet Specification PLT. 15.3 for more details.

Parameters:
name - the attribute name.
Returns:
portlet-scoped ID for the attribute name.

isInCurrentPortletScope

protected boolean isInCurrentPortletScope(java.lang.String name)
Checks if the attribute name in APPLICATION_SCOPE is in the current portlet scope.

Parameters:
name - the attribute name to check.
Returns:
true if the attribute name is in the current portlet scope.
See Also:
createPortletScopedId(String)

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface javax.servlet.http.HttpSession

getSessionContext

public javax.servlet.http.HttpSessionContext getSessionContext()
Deprecated. 

DEPRECATED: implemented for backwards compatability with HttpSession.

Specified by:
getSessionContext in interface javax.servlet.http.HttpSession

getValue

public java.lang.Object getValue(java.lang.String name)
Specified by:
getValue in interface javax.servlet.http.HttpSession

getValueNames

public java.lang.String[] getValueNames()
Deprecated. 

DEPRECATED: Implemented for backwards compatibility with HttpSession.

Specified by:
getValueNames in interface javax.servlet.http.HttpSession

putValue

public void putValue(java.lang.String name,
                     java.lang.Object value)
Specified by:
putValue in interface javax.servlet.http.HttpSession

removeValue

public void removeValue(java.lang.String name)
Specified by:
removeValue in interface javax.servlet.http.HttpSession


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.