com.j_spaces.www
Class DSession

java.lang.Object
  extended by com.j_spaces.core.client.MetaDataEntry
      extended by com.j_spaces.www.DSession
All Implemented Interfaces:
IMetaDataEntry, Serializable, Entry

public class DSession
extends MetaDataEntry

An adapter class that used to store HttpSession attributes in IMap.

 Example:
 To prepare HttpSession to be stored in IMap:
 DSession dsession = new DSession(session);
 
 To apply stored HttpSession attributed to another HttpSession object:
 session = dsession.toHttpSession(session);
 

See Also:
Serialized Form

Constructor Summary
DSession(HttpSession session)
          Creates DSession instance from supplied HttpSession object.
DSession(HttpSession session, Long creationTime)
          Creates DSession instance from supplied HttpSession object.
 
Method Summary
 long getCreationTime()
          Returns HttpSession.getCreationTime().
 String getId()
          Returns HttpSession.getId().
 long getLastAccessedTime()
          Returns HttpSession.getLastAccessedTime().
 int getMaxInactiveInterval()
          Returns HttpSession.getMaxInactiveInterval().
 Object getValue(String name)
          Returns the value of the source HttpSession attribute.
 String[] getValueNames()
          Returns the array of names of the source HttpSession attributes.
 void putValue(String name, Object value)
          Puts a new attribute into DSession instance.
 Object removeValue(String name)
          Removes attribute from DSession instance.
 HttpSession toHttpSession(HttpSession session)
          Attaches stored HttpSession attributed to another HttpSession instance.
 
Methods inherited from class com.j_spaces.core.client.MetaDataEntry
__getEntryInfo, __setEntryInfo, isFifo, isNOWriteLeaseMode, isTransient, makePersistent, makeTransient, setFifo, setNOWriteLeaseMode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSession

public DSession(HttpSession session)
Creates DSession instance from supplied HttpSession object.

Parameters:
session - the session to save

DSession

public DSession(HttpSession session,
                Long creationTime)
Creates DSession instance from supplied HttpSession object.

Parameters:
session - the session to save
creationTime - the session creation time
Method Detail

getCreationTime

public long getCreationTime()
Returns HttpSession.getCreationTime().

Returns:
HttpSession.getCreationTime().

getId

public String getId()
Returns HttpSession.getId().

Returns:
HttpSession.getId().

getLastAccessedTime

public long getLastAccessedTime()
Returns HttpSession.getLastAccessedTime().

Returns:
HttpSession.getLastAccessedTime().

getMaxInactiveInterval

public int getMaxInactiveInterval()
Returns HttpSession.getMaxInactiveInterval().

Returns:
HttpSession.getMaxInactiveInterval().

getValue

public Object getValue(String name)
Returns the value of the source HttpSession attribute.

Parameters:
name - the source name
Returns:
Value of the source HttpSession attribute.

getValueNames

public String[] getValueNames()
Returns the array of names of the source HttpSession attributes.

Returns:
Array of names of the source HttpSession attribute.

putValue

public void putValue(String name,
                     Object value)
Puts a new attribute into DSession instance.

Parameters:
name - source name
value - source value

removeValue

public Object removeValue(String name)
Removes attribute from DSession instance.

Parameters:
name - source name
Returns:
removed value

toHttpSession

public HttpSession toHttpSession(HttpSession session)
Attaches stored HttpSession attributed to another HttpSession instance. In fact, this process is a reconstruction of the source HttpSession object.

Parameters:
session - the source session
Returns:
HttpSession the merged session