Package org.apache.catalina
Interface Session
-
- All Known Subinterfaces:
HASession
- All Known Implementing Classes:
BaseHASession,FullHASession,ModifiedAttributeHASession,ModifiedHASession,StandardSession
public interface SessionA Session is the Catalina-internal facade for anHttpSessionthat is used to maintain state information between requests for a particular user of a web application.- Version:
- $Revision: 1.3 $ $Date: 2005/12/08 01:27:20 $
- Author:
- Craig R. McClanahan
-
-
Field Summary
Fields Modifier and Type Field Description static StringSESSION_CREATED_EVENTThe SessionEvent event type when a session is created.static StringSESSION_DESTROYED_EVENTThe SessionEvent event type when a session is destroyed.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.Map<String,Object>getAttributes()Gets the attributes of this session.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>.booleangetIsValid()Return theisValidflag for this session.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.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, ornullif 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.jakarta.servlet.http.HttpSessiongetSession()Return theHttpSessionfor which this object is the facade.StringgetSsoId()Return the single sign on id.longgetSsoVersion()Return the single sign on version.longgetVersion()Gets the version number of this SessionbooleanhasExpired()Checks whether this Session has expired.booleanisValid()Expire the expired session if necessary and return theisValidflag for this session.booleanlockForeground()lock the session for background returns true if successful; false if unsuccessfulvoidrecycle()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 theisNewflag 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.voidsetSsoId(String ssoId)Set the single sign on id.voidsetSsoVersion(long ssoVersion)Set the single sign on version.voidsetValid(boolean isValid)Set theisValidflag for this session.voidunlockForeground()unlock the session from foreground
-
-
-
Field Detail
-
SESSION_CREATED_EVENT
static final String SESSION_CREATED_EVENT
The SessionEvent event type when a session is created.- See Also:
- Constant Field Values
-
SESSION_DESTROYED_EVENT
static final String SESSION_DESTROYED_EVENT
The SessionEvent event type when a session is destroyed.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAuthType
String getAuthType()
Return the authentication type used to authenticate our cached Principal, if any.
-
setAuthType
void setAuthType(String authType)
Set the authentication type used to authenticate our cached Principal, if any.- Parameters:
authType- The new cached authentication type
-
getCreationTime
long getCreationTime()
Return the creation time for this session.
-
setCreationTime
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
-
getId
String getId()
Return the session identifier for this session.
-
getIdInternal
String getIdInternal()
Return the session identifier for this session.
-
setId
void setId(String id)
Set the session identifier for this session.- Parameters:
id- The new session identifier
-
getInfo
String getInfo()
Return descriptive information about this Session implementation and the corresponding version number, in the format<description>/<version>.
-
getLastAccessedTime
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.
-
getManager
Manager getManager()
Return the Manager within which this Session is valid.
-
setManager
void setManager(Manager manager)
Set the Manager within which this Session is valid.- Parameters:
manager- The new Manager
-
getMaxInactiveInterval
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.
-
setMaxInactiveInterval
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
void setNew(boolean isNew)
Set theisNewflag for this session.- Parameters:
isNew- The new value for theisNewflag
-
getPrincipal
Principal getPrincipal()
Return the authenticated Principal that is associated with this Session. This provides anAuthenticatorwith a means to cache a previously authenticated Principal, and avoid potentially expensiveRealm.authenticate()calls on every request. If there is no current associated Principal, returnnull.
-
setPrincipal
void setPrincipal(Principal principal)
Set the authenticated Principal that is associated with this Session. This provides anAuthenticatorwith a means to cache a previously authenticated Principal, and avoid potentially expensiveRealm.authenticate()calls on every request.- Parameters:
principal- The new Principal, ornullif none
-
getSession
jakarta.servlet.http.HttpSession getSession()
Return theHttpSessionfor which this object is the facade.
-
setValid
void setValid(boolean isValid)
Set theisValidflag for this session.- Parameters:
isValid- The new value for theisValidflag
-
isValid
boolean isValid()
Expire the expired session if necessary and return theisValidflag for this session.
-
getIsValid
boolean getIsValid()
Return theisValidflag for this session.
-
access
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
void addSessionListener(SessionListener listener)
Add a session event listener to this component.
-
endAccess
void endAccess()
End access to the session.
-
expire
void expire()
Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired.
-
getNote
Object getNote(String name)
Return the object bound with the specified name to the internal notes for this session, ornullif no such binding exists.- Parameters:
name- Name of the note to be returned
-
getNoteNames
Iterator getNoteNames()
Return an Iterator containing the String names of all notes bindings that exist for this session.
-
recycle
void recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object.
-
removeNote
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
void removeSessionListener(SessionListener listener)
Remove a session event listener from this component.
-
setNote
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 boundvalue- Object to be bound to the specified name
-
hasExpired
boolean hasExpired()
Checks whether this Session has expired.- Returns:
- true if this Session has expired, false otherwise
-
getVersion
long getVersion()
Gets the version number of this Session
-
getAttributes
Map<String,Object> getAttributes()
Gets the attributes of this session.- Returns:
- the attributes of this session
-
getSsoId
String getSsoId()
Return the single sign on id. It is null if there is no SSO.
-
setSsoId
void setSsoId(String ssoId)
Set the single sign on id.
-
getSsoVersion
long getSsoVersion()
Return the single sign on version.
-
setSsoVersion
void setSsoVersion(long ssoVersion)
Set the single sign on version.
-
lockForeground
boolean lockForeground()
lock the session for background returns true if successful; false if unsuccessful
-
unlockForeground
void unlockForeground()
unlock the session from foreground
-
-