FileDocCategorySizeDatePackage
Session.javaAPI DocGlassfish v2 API9353Fri May 04 22:31:52 BST 2007org.apache.catalina

Session

public interface Session
A Session is the Catalina-internal facade for an HttpSession that is used to maintain state information between requests for a particular user of a web application.
author
Craig R. McClanahan
version
$Revision: 1.4 $ $Date: 2007/05/05 05:31:51 $

Fields Summary
public static final String
SESSION_CREATED_EVENT
The SessionEvent event type when a session is created.
public static final String
SESSION_DESTROYED_EVENT
The SessionEvent event type when a session is destroyed.
Constructors Summary
Methods Summary
public voidaccess()
Update the accessed time information for this session. This method should be called by the context when a request comes in for a particular session, even if the application does not reference it.

public voidaddSessionListener(SessionListener listener)
Add a session event listener to this component.

public voidendAccess()
End access to the session.

public voidexpire()
Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.

public java.lang.StringgetAuthType()
Return the authentication type used to authenticate our cached Principal, if any.

public longgetCreationTime()
Return the creation time for this session.

public java.lang.StringgetId()
Return the session identifier for this session.

public java.lang.StringgetIdInternal()
Return the session identifier for this session.

public java.lang.StringgetInfo()
Return descriptive information about this Session implementation and the corresponding version number, in the format <description>/<version>.

public longgetLastAccessedTime()
Return the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.

public ManagergetManager()
Return the Manager within which this Session is valid.

public intgetMaxInactiveInterval()
Return the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out.

public java.lang.ObjectgetNote(java.lang.String name)
Return the object bound with the specified name to the internal notes for this session, or null if no such binding exists.

param
name Name of the note to be returned

public java.util.IteratorgetNoteNames()
Return an Iterator containing the String names of all notes bindings that exist for this session.

public java.security.PrincipalgetPrincipal()
Return the authenticated Principal that is associated with this Session. This provides an Authenticator with a means to cache a previously authenticated Principal, and avoid potentially expensive Realm.authenticate() calls on every request. If there is no current associated Principal, return null.

public javax.servlet.http.HttpSessiongetSession()
Return the HttpSession for which this object is the facade.

public booleanhasExpired()
Checks whether this Session has expired.

return
true if this Session has expired, false otherwise

public booleanisValid()
Return the isValid flag for this session.

public voidrecycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object.

public voidremoveNote(java.lang.String name)
Remove any object bound to the specified name in the internal notes for this session.

param
name Name of the note to be removed

public voidremoveSessionListener(SessionListener listener)
Remove a session event listener from this component.

public voidsetAuthType(java.lang.String authType)
Set the authentication type used to authenticate our cached Principal, if any.

param
authType The new cached authentication type

public voidsetCreationTime(long time)
Set the creation time for this session. This method is called by the Manager when an existing Session instance is reused.

param
time The new creation time

public voidsetId(java.lang.String id)
Set the session identifier for this session.

param
id The new session identifier

public voidsetManager(Manager manager)
Set the Manager within which this Session is valid.

param
manager The new Manager

public voidsetMaxInactiveInterval(int interval)
Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out.

param
interval The new maximum interval

public voidsetNew(boolean isNew)
Set the isNew flag for this session.

param
isNew The new value for the isNew flag

public voidsetNote(java.lang.String name, java.lang.Object value)
Bind an object to a specified name in the internal notes associated with this session, replacing any existing binding for this name.

param
name Name to which the object should be bound
param
value Object to be bound to the specified name

public voidsetPrincipal(java.security.Principal principal)
Set the authenticated Principal that is associated with this Session. This provides an Authenticator with a means to cache a previously authenticated Principal, and avoid potentially expensive Realm.authenticate() calls on every request.

param
principal The new Principal, or null if none

public voidsetValid(boolean isValid)
Set the isValid flag for this session.

param
isValid The new value for the isValid flag