org.apache.catalina

Interface 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.

Version: $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $

Author: Craig R. McClanahan

Field Summary
static StringSESSION_ACTIVATED_EVENT
The SessionEvent event type when a session is activated.
static StringSESSION_CREATED_EVENT
The SessionEvent event type when a session is created.
static StringSESSION_DESTROYED_EVENT
The SessionEvent event type when a session is destroyed.
static StringSESSION_PASSIVATED_EVENT
The SessionEvent event type when a session is passivated.
Method Summary
voidaccess()
Update the accessed time information for this session.
voidaddSessionListener(SessionListener listener)
Add a session event listener to this component.
voidendAccess()
End access to the session.
voidexpire()
Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.
StringgetAuthType()
Return the authentication type used to authenticate our cached Principal, if any.
longgetCreationTime()
Return the creation time for this session.
StringgetId()
Return the session identifier for this session.
StringgetIdInternal()
Return the session identifier for this session.
StringgetInfo()
Return descriptive information about this Session implementation and the corresponding version number, in the format <description>/<version>.
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.
longgetLastAccessedTimeInternal()
Return the last client access time without invalidation check
ManagergetManager()
Return the Manager within which this Session is valid.
intgetMaxInactiveInterval()
Return the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session.
ObjectgetNote(String name)
Return the object bound with the specified name to the internal notes for this session, or null if no such binding exists.
IteratorgetNoteNames()
Return an Iterator containing the String names of all notes bindings that exist for this session.
PrincipalgetPrincipal()
Return the authenticated Principal that is associated with this Session.
HttpSessiongetSession()
Return the HttpSession for which this object is the facade.
booleanisValid()
Return the isValid flag for this session.
voidrecycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object.
voidremoveNote(String name)
Remove any object bound to the specified name in the internal notes for this session.
voidremoveSessionListener(SessionListener listener)
Remove a session event listener from this component.
voidsetAuthType(String authType)
Set the authentication type used to authenticate our cached Principal, if any.
voidsetCreationTime(long time)
Set the creation time for this session.
voidsetId(String id)
Set the session identifier for this session.
voidsetManager(Manager manager)
Set the Manager within which this Session is valid.
voidsetMaxInactiveInterval(int interval)
Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session.
voidsetNew(boolean isNew)
Set the isNew flag for this session.
voidsetNote(String name, Object value)
Bind an object to a specified name in the internal notes associated with this session, replacing any existing binding for this name.
voidsetPrincipal(Principal principal)
Set the authenticated Principal that is associated with this Session.
voidsetValid(boolean isValid)
Set the isValid flag for this session.

Field Detail

SESSION_ACTIVATED_EVENT

public static final String SESSION_ACTIVATED_EVENT
The SessionEvent event type when a session is activated.

SESSION_CREATED_EVENT

public static final String SESSION_CREATED_EVENT
The SessionEvent event type when a session is created.

SESSION_DESTROYED_EVENT

public static final String SESSION_DESTROYED_EVENT
The SessionEvent event type when a session is destroyed.

SESSION_PASSIVATED_EVENT

public static final String SESSION_PASSIVATED_EVENT
The SessionEvent event type when a session is passivated.

Method Detail

access

public void access()
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.

addSessionListener

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

endAccess

public void endAccess()
End access to the session.

expire

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

getAuthType

public String getAuthType()
Return the authentication type used to authenticate our cached Principal, if any.

getCreationTime

public long getCreationTime()
Return the creation time for this session.

getId

public String getId()
Return the session identifier for this session.

getIdInternal

public String getIdInternal()
Return the session identifier for this session.

getInfo

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

getLastAccessedTime

public long getLastAccessedTime()
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.

getLastAccessedTimeInternal

public long getLastAccessedTimeInternal()
Return the last client access time without invalidation check

See Also: .

getManager

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

getMaxInactiveInterval

public int getMaxInactiveInterval()
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.

getNote

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

Parameters: name Name of the note to be returned

getNoteNames

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

getPrincipal

public Principal getPrincipal()
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.

getSession

public HttpSession getSession()
Return the HttpSession for which this object is the facade.

isValid

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

recycle

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

removeNote

public void removeNote(String name)
Remove any object bound to the specified name in the internal notes for this session.

Parameters: name Name of the note to be removed

removeSessionListener

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

setAuthType

public void setAuthType(String authType)
Set the authentication type used to authenticate our cached Principal, if any.

Parameters: authType The new cached authentication type

setCreationTime

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

Parameters: time The new creation time

setId

public void setId(String id)
Set the session identifier for this session.

Parameters: id The new session identifier

setManager

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

Parameters: manager The new Manager

setMaxInactiveInterval

public void setMaxInactiveInterval(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.

Parameters: interval The new maximum interval

setNew

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

Parameters: isNew The new value for the isNew flag

setNote

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

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

setPrincipal

public void setPrincipal(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.

Parameters: principal The new Principal, or null if none

setValid

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

Parameters: isValid The new value for the isValid flag

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.