org.apache.tomcat.core
Interface SessionManager


public interface SessionManager

Author:
Craig R. McClanahan, costin@dnt.ro, Gal Shachor shachor@il.ibm.com

Method Summary
 void accessed(Context ctx, Request req, java.lang.String id)
          Will mark the session lastAccess time.
 javax.servlet.http.HttpSession createSession(Context ctx)
          Construct and return a new session object, based on the default settings specified by this Manager's properties.
 javax.servlet.http.HttpSession findSession(Context ctx, java.lang.String id)
          Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.
 void removeSessions(Context ctx)
          Used by context when stoped, need to remove all sessions used by that context
 void setSessionTimeOut(int minutes)
          Used by context to configure the session manager's inactivity timeout.
 

Method Detail

createSession

public javax.servlet.http.HttpSession createSession(Context ctx)
Construct and return a new session object, based on the default settings specified by this Manager's properties. The session id will be assigned by this method, and available via the getId() method of the returned session. If a new session cannot be created for any reason, return null.
Parameters:
ctx - The session will be created for the specified context
Throws:
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason

accessed

public void accessed(Context ctx,
                     Request req,
                     java.lang.String id)
Will mark the session lastAccess time. Will be called for each request that has a valid sessionId A simple SessionManager will just use the id, a complex manager may use the ctx and req to do additional work.
Parameters:
ctx - the context where the request belong
req - the request having the id
id -  

findSession

public javax.servlet.http.HttpSession findSession(Context ctx,
                                                  java.lang.String id)
Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.
Parameters:
id - The session id for the session to be returned
ctx - The session needs to belong to the context
Throws:
java.lang.ClassNotFoundException - if a deserialization error occurs while processing this request
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason

removeSessions

public void removeSessions(Context ctx)
Used by context when stoped, need to remove all sessions used by that context

setSessionTimeOut

public void setSessionTimeOut(int minutes)
Used by context to configure the session manager's inactivity timeout. The SessionManager may have some default session time out, the Context on the other hand has it's timeout set by the deployment descriptor (web.xml). This method lets the Context conforgure the session manager according to this value.
Parameters:
minutes - The session inactivity timeout in minutes.


Copyright © 2000 Apache Software Foundation. All Rights Reserved.