© 2005 BEA Systems, Inc.

com.bea.p13n.http
Class Session

java.lang.Object
  extended bycom.bea.p13n.http.HttpConfigurableEntity
      extended bycom.bea.p13n.http.Session
All Implemented Interfaces:
ConfigurableEntity, HttpSession, Serializable

public class Session
extends HttpConfigurableEntity
implements Serializable, 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

Nested Class Summary
static interface Session.AttributeLoader
          An object which is capable of loading additional attributes into a Session.
 
Field Summary
static String SESSION_PROPERTY_SET_TYPE
          request property set type
 
Fields inherited from interface com.bea.p13n.property.ConfigurableEntity
RESERVED_PROPERTY_SET
 
Constructor Summary
Session()
          Default (empty) constructor
Session(HttpServletRequest request)
          Creates a P13N HTTP Session.
Session(HttpSession session)
          Creates a P13N HTTP Session.
 
Method Summary
static Session createP13NSession(HttpServletRequest request)
          Returns a P13N Session that acts as a surrogate for an HTTP session.
 Object getAttribute(String name)
           
 Enumeration getAttributeNames()
           
 long getCreationTime()
           
 String getId()
          Returns the id of the HttpSession for which this surrogate represents
 long getLastAccessedTime()
           
 int getMaxInactiveInterval()
           
 Object getProperty(String propertySet, String propertyName)
          Retrieves a property value for the specified scope and key.
 Object getPropertyNoDefault(String propertySet, String propertyName)
          Retrieves a property value for the specified scope and key.
 ServletContext getServletContext()
          Always returns null
 HttpSessionContext getSessionContext()
           
 Object getValue(String name)
           
 String[] getValueNames()
           
 void invalidate()
           
 boolean isNew()
           
 void putValue(String name, Object val)
           
 void removeAttribute(String name)
           
 void removeValue(String name)
           
 void setAttribute(String name, Object val)
           
 void setMaxInactiveInterval(int interval)
           
 
Methods inherited from class com.bea.p13n.http.HttpConfigurableEntity
getJndiName, getPkString, getProperty, getPropertyAsString, getPropertyDefault, getPropertySetManager, 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 String SESSION_PROPERTY_SET_TYPE
request property set type

See Also:
Constant Field Values
Constructor Detail

Session

public Session()
Default (empty) constructor


Session

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


Session

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

Method Detail

createP13NSession

public static Session createP13NSession(HttpServletRequest request)
                                 throws 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:
IllegalArgumentException - If the paramater is null.

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface HttpSession

getAttributeNames

public Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface HttpSession

getCreationTime

public long getCreationTime()
Specified by:
getCreationTime in interface HttpSession

getId

public String getId()
Returns the id of the HttpSession for which this surrogate represents

Specified by:
getId in interface HttpSession
Returns:
The Http Session id, returns null if the id is not valid

getLastAccessedTime

public long getLastAccessedTime()
Specified by:
getLastAccessedTime in interface HttpSession

getMaxInactiveInterval

public int getMaxInactiveInterval()
Specified by:
getMaxInactiveInterval in interface HttpSession

getProperty

public Object getProperty(String propertySet,
                          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 propertySet parameter to find a propeerty set for a SESSION type. If found, it uses the default value in the property set.

Specified by:
getProperty in interface ConfigurableEntity
Specified by:
getProperty in class HttpConfigurableEntity
Parameters:
propertySet - The name of the property set for which the property is sought. The property set is only used if no property is found in the session and we use the property set to look up the default value in the PropertySet for the session. This parameter can be null.
propertyName - The property name.
Returns:
the property value
See Also:
getPropertyNoDefault(java.lang.String, java.lang.String)

getPropertyNoDefault

public Object getPropertyNoDefault(String propertySet,
                                   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 propertySet parameter to find a propeerty set for a SESSION type. If found, it uses the default value in the property set.

Specified by:
getPropertyNoDefault in interface ConfigurableEntity
Specified by:
getPropertyNoDefault in class HttpConfigurableEntity
Parameters:
propertySet - The name of the property set for which the property is sought. The property set is only used if no property is found in the session and we use the property set to look up the default value in the PropertySet for the session. This parameter can be null.
propertyName - The property name.
Returns:
the property value

getServletContext

public ServletContext getServletContext()
Always returns null

Specified by:
getServletContext in interface HttpSession

getSessionContext

public HttpSessionContext getSessionContext()
Specified by:
getSessionContext in interface HttpSession

getValue

public Object getValue(String name)
Specified by:
getValue in interface HttpSession

getValueNames

public String[] getValueNames()
Specified by:
getValueNames in interface HttpSession

invalidate

public void invalidate()
Specified by:
invalidate in interface HttpSession

isNew

public boolean isNew()
Specified by:
isNew in interface HttpSession

putValue

public void putValue(String name,
                     Object val)
Specified by:
putValue in interface HttpSession

removeAttribute

public void removeAttribute(String name)
Specified by:
removeAttribute in interface HttpSession

removeValue

public void removeValue(String name)
Specified by:
removeValue in interface HttpSession

setAttribute

public void setAttribute(String name,
                         Object val)
Specified by:
setAttribute in interface HttpSession

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
Specified by:
setMaxInactiveInterval in interface HttpSession

© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved