© 2002 BEA Systems, Inc.


com.bea.p13n.http
Class Session

java.lang.Object
  |
  +--com.bea.p13n.http.HttpConfigurableEntity
        |
        +--com.bea.p13n.http.Session

public class Session
extends HttpConfigurableEntity
implements java.io.Serializable, javax.servlet.http.HttpSession

The Personalization Server implementation of the Http Session interface.

This object is used by the Personalization Server to get properties on an Http Session in a format understandable to Personalization Core Services such as the Rules Service. Note, we require the request to be passed into many methods since there are cases where we need to look at the request. The getProperty method will look in the HTTP session attributes for the property./

This will use a DefaultRequestFilter to filter out attributes. After loading the request attributes, this will additionally call out to any AttributeLoaders specified by the AttributeLoaderMBean's SessionLoaders attribute./

See Also:
Serialized Form

Inner Class Summary
static interface Session.AttributeLoader
          An object which is capable of loading additional attributes into a Session.
 
Field Summary
static java.lang.String SESSION_PROPERTY_SET_TYPE
          request property set type
 
Fields inherited from class com.bea.p13n.http.HttpConfigurableEntity
PROPERTY_SET_MANAGER
 
Constructor Summary
Session()
          Default (empty) constructor
Session(javax.servlet.http.HttpServletRequest request)
          Creates a P13N HTTP Session.
Session(javax.servlet.http.HttpSession session)
          Creates a P13N HTTP Session.
 
Method Summary
static Session createP13NSession(javax.servlet.http.HttpServletRequest request)
          Returns a P13N Session that acts as a surrogate for an HTTP session.
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Enumeration getAttributeNames()
           
 long getCreationTime()
           
 java.lang.String getId()
          Returns the id of the HttpSession for which this surrogate represents
 long getLastAccessedTime()
           
 int getMaxInactiveInterval()
           
 java.lang.Object getProperty(java.lang.String propertySet, java.lang.String propertyName)
          Retrieves a property value for the specified scope and key.
 javax.servlet.ServletContext getServletContext()
          Always returns null
 javax.servlet.http.HttpSessionContext getSessionContext()
           
 java.lang.Object getValue(java.lang.String name)
           
 java.lang.String[] getValueNames()
           
 void invalidate()
           
 boolean isNew()
           
 void putValue(java.lang.String name, java.lang.Object val)
           
 void removeAttribute(java.lang.String name)
           
 void removeValue(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object val)
           
 void setMaxInactiveInterval(int interval)
           
 
Methods inherited from class com.bea.p13n.http.HttpConfigurableEntity
getJndiName, getPkString, getProperty, getPropertyAsString, getPropertyDefault, getPropertyNoDefault, getUniqueId, removeProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SESSION_PROPERTY_SET_TYPE

public static final java.lang.String SESSION_PROPERTY_SET_TYPE
request property set type
Constructor Detail

Session

public Session()
Default (empty) constructor

Session

public Session(javax.servlet.http.HttpServletRequest request)
Creates a P13N HTTP Session. This object clones the session values provided in the session in the HttpRequest.

Parameters:
session - the HttpServletRequest used to get the Http session values.

Session

public Session(javax.servlet.http.HttpSession session)
Creates a P13N HTTP Session. This object clones the session values provided in the session

Parameters:
session - the HttpSession used to get the Http session values.
Method Detail

createP13NSession

public static Session createP13NSession(javax.servlet.http.HttpServletRequest request)
                                 throws java.lang.IllegalArgumentException
Returns a P13N Session that acts as a surrogate for an HTTP session. This method will return a new P13N Session.

Parameters:
request - the request used to create the Session object.
Returns:
a new ConfigurableEntity that allows access to an HttpServletSession
Throws:
java.lang.IllegalArgumentException - If the paramater is null.

getProperty

public java.lang.Object getProperty(java.lang.String propertySet,
                                    java.lang.String propertyName)
Retrieves a property value for the specified scope and key. The getProperty method will first look in the cloned session values for the property. If not found, then it uses the scopeName parameter to find a schema entity for a 'SESSION' schema group name. If found, it uses the default value in the schema.

Parameters:
scopeName - The name of the scope for which the property is sought. The scope is only used if no property is found in the request and we use the scope to look up the default value in the Schema for the request. This parameter can be null.
key - The property name. This name should be "de-qualified" since the creation of this object instance loaded the session values from the current Service Provider for the current request. For example, if the HttpSession has PortalA.frequentFlyer, use frequentFlyer for this parameter.
successor - The successor. Must be null. It is not used in this method and will be ignored.
defaultValue - the default value to return if the property is not found
Returns:
the property value
Overrides:
getProperty in class HttpConfigurableEntity

getCreationTime

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


getId

public java.lang.String getId()
Returns the id of the HttpSession for which this surrogate represents
Specified by:
getId in interface javax.servlet.http.HttpSession

Returns:
The Http Session id, returns null if the id is not valid

getLastAccessedTime

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


setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
Specified by:
setMaxInactiveInterval in interface javax.servlet.http.HttpSession


getMaxInactiveInterval

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


getSessionContext

public javax.servlet.http.HttpSessionContext getSessionContext()
Specified by:
getSessionContext in interface javax.servlet.http.HttpSession


getServletContext

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


getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Specified by:
getAttribute 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


getAttributeNames

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


getValueNames

public java.lang.String[] getValueNames()
Specified by:
getValueNames in interface javax.servlet.http.HttpSession


setAttribute

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


putValue

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


removeAttribute

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


removeValue

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


invalidate

public void invalidate()
Specified by:
invalidate in interface javax.servlet.http.HttpSession


isNew

public boolean isNew()
Specified by:
isNew in interface javax.servlet.http.HttpSession


© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved