FileDocCategorySizeDatePackage
Session.javaAPI DocExample6251Tue May 29 16:56:46 BST 2007com.sun.xml.ws.runtime.util

Session

public class Session extends Object
The Session object is used to manage state between multiple requests from the same client. It contains a session key field to uniquely identify the Session, a SecurityInfo field that contains the security parameters used to protect the session and userdata field that can store the state for multiple requests from the client.
author
Bhakti Mehta
author
Mike Grogan

Fields Summary
public static final String
SESSION_ID_KEY
Well-known invocationProperty names
public static final String
SESSION_KEY
private final SessionManager
manager
Session manager that can handle Sessions of this exact type. (Different SessionManagers might use different subclasses of this Class)
private final String
key
Unique key based either on the SCT or RM sequence id for the session
private final Object
userData
A container for user-defined data that will be exposed in WebServiceContext.
private com.sun.xml.ws.security.SecurityContextTokenInfo
securityInfo
private com.sun.xml.ws.rm.Sequence
sequence
private final long
creationTime
private long
lastAccessedTime
Constructors Summary
public Session(SessionManager manager, String key, Object userData)
Public constructor

param
manager - A SessionManager that can handle Sessions of this type.
param
key - The unique session id
param
data - Holder for user-defined data.

    
                                       
           
        this.manager = manager;
        this.userData = userData;
        this.key = key;
        creationTime = lastAccessedTime = 
              System.currentTimeMillis();
    
Methods Summary
public longgetCreationTime()
Accessor for creation time.

returns
The creation time.

        return creationTime;
    
public longgetLastAccessedTime()
Accessor for lastAccessed time, which can be used to invalidate Sessions have not been active since a certain time.

returns
The lastAccessedTime

        return lastAccessedTime;
    
public com.sun.xml.ws.security.SecurityContextTokenInfogetSecurityInfo()
Accessor for the securityInfo field.

returns
The value of the field.

        return securityInfo;
    
public com.sun.xml.ws.rm.SequencegetSequence()
Accessor for the sequence field.

return
The value of the field.

        return sequence;
    
public java.lang.StringgetSessionKey()
Accessor for Session Key.

returns
The session key

        return key;
    
public java.lang.ObjectgetUserData()
Accessor for the userData field.

return
The value of the field.

        return userData;
    
public voidresetLastAccessedTime()
Resets the lastAccessedTime to the current time.

        lastAccessedTime = System.currentTimeMillis();
    
public voidsave()
Saves the state of the session using whatever persistence mechanism the SessionManager offers.

        manager.saveSession(getSessionKey());
    
public voidsetSecurityInfo(com.sun.xml.ws.security.SecurityContextTokenInfo securityInfo)
Mutator for the securityInfo field.

returns
The value of the field.

        this.securityInfo = securityInfo;
    
public voidsetSequence(com.sun.xml.ws.rm.Sequence sequence)
Mutator for the securityInfo field.

returns
The value of the field.

        this.sequence = sequence;