# com.bea.p13n.http
Session Class

public class Session
extends `HttpConfigurableEntity`
implements `HttpSession`, `Serializable`

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 `Session.AttributeLoader``` specified by the AttributeLoaderMBean's SessionLoaders attribute./

Hierarchy
  `Object`
  `HttpConfigurableEntity`
  `Session`

All Implemented Interfaces
  `ConfigurableEntity`, `HttpSession`, `Serializable`

## Nested Class Summary

`public static interface` | `Session.AttributeLoader` An object which is capable of loading additional attributes into a Session.

## Field Summary

`public static final `String`` | `SESSION_PROPERTY_SET_TYPE` request property set type

## Constructor Summary

Session() Default (empty) constructor
Session(`HttpServletRequest` request) Creates a P13N HTTP Session.
Session(`HttpSession` session) Creates a P13N HTTP Session.

## Method Summary

`public static `Session`` | `createP13NSession`(`HttpServletRequest` request) Returns a P13N Session that acts as a surrogate for an HTTP session.
`public `Object`` | `getAttribute`(`String` name)
`public `Enumeration`` | `getAttributeNames`()
`public long` | `getCreationTime`()
`public `String`` | `getId`() Returns the id of the HttpSession for which this surrogate represents
`public long` | `getLastAccessedTime`()
`public int` | `getMaxInactiveInterval`()
`public `Object`` | `getProperty`(`String` propertySet, `String` propertyName) Retrieves a property value for the specified scope and key.
`public `Object`` | `getPropertyNoDefault`(`String` propertySet, `String` propertyName) Retrieves a property value for the specified scope and key.
`public `ServletContext`` | `getServletContext`() Always returns null
`public `HttpSessionContext`` | `getSessionContext`()
`public `Object`` | `getValue`(`String` name)
`public `String`[]` | `getValueNames`()
`public void` | `invalidate`()
`public boolean` | `isNew`()
`public void` | `putValue`(`String` name, `Object` val)
`public void` | `removeAttribute`(`String` name)
`public void` | `removeValue`(`String` name)
`public void` | `setAttribute`(`String` name, `Object` val)
`public void` | `setMaxInactiveInterval`(int interval)

Methods from `com.bea.p13n.http.`HttpConfigurableEntity``
``getJndiName`, `getPkString`, `getProperty`, `getPropertyAsString`, `getPropertyDefault`, `getPropertySetManager`, `getUniqueId`, `removeProperty`, `setProperty``

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `com.bea.p13n.property.`ConfigurableEntity``
``getJndiName`, `getPkString`, `getProperty`, `getPropertyAsString`, `getPropertyNoDefault`, `getUniqueId`, `removeProperty`, `setProperty``

Methods from interface `javax.servlet.http.`HttpSession``
`getAttribute, getAttributeNames, getCreationTime, getId, getLastAccessedTime, getMaxInactiveInterval, getServletContext, getSessionContext, getValue, getValueNames, invalidate, isNew, putValue, removeAttribute, removeValue, setAttribute, setMaxInactiveInterval`

## Field Detail

### SESSION_PROPERTY_SET_TYPE

    public static final String SESSION_PROPERTY_SET_TYPE

  request property set type

## 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(HttpServletRequest) Method

    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`

#### Exceptions

``IllegalArgumentException``
  If the paramater is null.

### getAttribute(String) Method

    public Object getAttribute(String name)

### getAttributeNames() Method

    public Enumeration getAttributeNames()

### getCreationTime() Method

    public long getCreationTime()

### getId() Method

    public String getId()

Returns the id of the HttpSession for which this surrogate represents

#### Returns

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

### getLastAccessedTime() Method

    public long getLastAccessedTime()

### getMaxInactiveInterval() Method

    public int getMaxInactiveInterval()

### getProperty(String, String) Method

    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.

Overrides
  `HttpConfigurableEntity.getProperty(String, String)`

#### 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

Related Topics

``Session.getPropertyNoDefault(String, String)``

### getPropertyNoDefault(String, String) Method

    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.

Overrides
  `HttpConfigurableEntity.getPropertyNoDefault(String, String)`

#### 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() Method

    public ServletContext getServletContext()

Always returns null

### getSessionContext() Method

    public HttpSessionContext getSessionContext()

### getValue(String) Method

    public Object getValue(String name)

### getValueNames() Method

    public String[] getValueNames()

### invalidate() Method

    public void invalidate()

### isNew() Method

    public boolean isNew()

### putValue(String, Object) Method

    public void putValue(String name,
                         Object val)

### removeAttribute(String) Method

    public void removeAttribute(String name)

### removeValue(String) Method

    public void removeValue(String name)

### setAttribute(String, Object) Method

    public void setAttribute(String name,
                             Object val)

### setMaxInactiveInterval(int) Method

    public void setMaxInactiveInterval(int interval)