org.apache.tomcat.modules.session
Class SimpleSessionStore

java.lang.Object
  extended byorg.apache.tomcat.core.BaseInterceptor
      extended byorg.apache.tomcat.modules.session.SimpleSessionStore

public final class SimpleSessionStore
extends BaseInterceptor

A simple session store plugin. It will create, store and maintain session objects using a simple in-memory pool. It must be inserted after SessionId, which does common session stuff ( cookie, rewrite, etc)

Author:
costin@eng.sun.com, hans@gefionsoftware.com, pfrieden@dChain.com, Shai Fultheim [shai@brm.com]

Nested Class Summary
static class SimpleSessionStore.SimpleSessionManager
          The actual "simple" manager
 
Field Summary
 
Fields inherited from class org.apache.tomcat.core.BaseInterceptor
cm, ct, ctx, debug, DECLINED, loghelper, OK
 
Constructor Summary
SimpleSessionStore()
           
 
Method Summary
 void contextInit(Context ctx)
          Init session management stuff for this context.
 void contextShutdown(Context ctx)
          Notification of context shutdown.
 void engineInit(ContextManager cm)
          Initialize the module.
 ServerSession findSession(Context ctx, java.lang.String sessionId)
           
 ServerSession findSession(Request request, java.lang.String sessionId, boolean create)
          The session store hook
 int getRecycledCount(Context ctx)
           
 int getSessionCount(Context ctx)
           
 java.util.Enumeration getSessionIds(Context ctx)
           
 java.util.Enumeration getSessions(Context ctx)
           
 void reload(Request req, Context ctx)
          Reload notification - called whenever a reload is done.
 int sessionState(Request req, ServerSession session, int state)
          Hook for session state changes.
 void setInitialPool(int initial)
           
 void setMaxActiveSessions(int count)
           
 void setMaxPool(int max)
           
 
Methods inherited from class org.apache.tomcat.core.BaseInterceptor
addContainer, addContext, addHandler, addInterceptor, addSecurityConstraint, afterBody, authenticate, authorize, beforeBody, beforeCommit, contextMap, contextState, engineShutdown, engineStart, engineState, engineStop, getContext, getContextManager, getDebug, getInfo, getLog, getNote, getNote, handleError, log, log, log, log, postReadRequest, postRequest, postService, postServletDestroy, postServletInit, preService, preServletDestroy, preServletInit, registerHooks, removeContainer, removeContext, removeHandler, removeInterceptor, requestMap, setContext, setContextManager, setDebug, setInfo, setNote, setNote
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSessionStore

public SimpleSessionStore()
Method Detail

setMaxActiveSessions

public void setMaxActiveSessions(int count)

setInitialPool

public void setInitialPool(int initial)

setMaxPool

public void setMaxPool(int max)

engineInit

public void engineInit(ContextManager cm)
                throws TomcatException
Description copied from class: BaseInterceptor
Initialize the module.

Overrides:
engineInit in class BaseInterceptor
Throws:
TomcatException - The module will not be added if any exception is thrown by engineInit.

reload

public void reload(Request req,
                   Context ctx)
            throws TomcatException
Description copied from class: BaseInterceptor
Reload notification - called whenever a reload is done. This can be used to serialize sessions, log the event, remove any resource that was class-loader dependent. Note. The current implementation uses a note "oldLoader" that will keep a reference to the previous class loader during this hook. It will be set by the module that creates the loaders, and should be destroyed when the hook is done. This can also be implemented using a get/setOldClassLoader in Context, but so far this is used in only 2 modules, adding new API is not needed.

Overrides:
reload in class BaseInterceptor
Throws:
TomcatException

findSession

public ServerSession findSession(Request request,
                                 java.lang.String sessionId,
                                 boolean create)
The session store hook

Overrides:
findSession in class BaseInterceptor
Parameters:
sessionId - if null the manager will generate the id

contextInit

public void contextInit(Context ctx)
                 throws TomcatException
Init session management stuff for this context.

Overrides:
contextInit in class BaseInterceptor
Throws:
TomcatException

contextShutdown

public void contextShutdown(Context ctx)
                     throws TomcatException
Notification of context shutdown. We should clean up any resources that are used by our session management code.

Overrides:
contextShutdown in class BaseInterceptor
Throws:
TomcatException

sessionState

public int sessionState(Request req,
                        ServerSession session,
                        int state)
Description copied from class: BaseInterceptor
Hook for session state changes. Will be called every time a session change it's state. A session module will announce all changes - like STATE_NEW when the session is created, STATE_EXPIRED when the session is expired, STATE_INVALID when the session is invalidated.

Overrides:
sessionState in class BaseInterceptor

getSessionIds

public java.util.Enumeration getSessionIds(Context ctx)

getSessions

public java.util.Enumeration getSessions(Context ctx)

getSessionCount

public int getSessionCount(Context ctx)

getRecycledCount

public int getRecycledCount(Context ctx)

findSession

public ServerSession findSession(Context ctx,
                                 java.lang.String sessionId)


Copyright © 2001 Apache Software Foundation. All Rights Reserved.