|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.server.session.SessionManager
public final class SessionManager
Manages sessions in a web-app.
| Field Summary | |
|---|---|
protected static L10N |
L
|
protected static java.util.logging.Logger |
log
|
| Constructor Summary | |
|---|---|
SessionManager(WebApp app)
Creates and initializes a new session manager |
|
| Method Summary | |
|---|---|
void |
addActivationListener(HttpSessionActivationListener listener)
Adds a new HttpSessionActivationListener. |
void |
addAttributeListener(HttpSessionAttributeListener listener)
Adds a new HttpSessionAttributeListener. |
void |
addListener(HttpSessionListener listener)
Adds a new HttpSessionListener. |
void |
close()
Cleans up the sessions when the WebApp shuts down gracefully. |
boolean |
containsSession(java.lang.String id)
Returns true if the session exists in this manager. |
StoreManager |
createFileStore()
Sets the file store. |
StoreManager |
createJdbcStore()
Sets the jdbc store. |
SessionImpl |
createSession(java.lang.String oldId,
long now,
HttpServletRequest request,
boolean fromCookie)
Create a new session. |
java.lang.String |
createSessionId(HttpServletRequest request)
Creates a pseudo-random session id. |
java.lang.String |
createSessionId(HttpServletRequest request,
boolean create)
Creates a pseudo-random session id. |
java.lang.String |
createSessionIdImpl(HttpServletRequest request)
|
static int |
decode(int code)
|
boolean |
enableSessionCookies()
Returns true if sessions use the cookie header. |
boolean |
enableSessionUrls()
Returns true if sessions can use the session rewriting. |
int |
getActiveSessionCount()
Returns the current number of active sessions. |
SessionManagerMXBean |
getAdmin()
Returns the admin. |
java.lang.String |
getAlternateSessionPrefix()
Returns the alternate session prefix, before the URL for wap. |
protected Cluster |
getCluster()
Gets the cluster. |
java.lang.String |
getCookieDomain()
Returns the default session cookie domain. |
long |
getCookieLength()
Returns the cookie length. |
long |
getCookieMaxAge()
Returns the max-age of the session cookie. |
java.lang.String |
getCookieName()
Returns the default cookie name. |
java.lang.String |
getCookiePort()
Gets the cookie ports. |
boolean |
getCookieSecure()
Returns the secure of the session cookie. |
int |
getCookieVersion()
Returns the cookie version. |
java.util.logging.Logger |
getDebug()
Returns the debug log |
java.lang.String |
getDistributionId()
|
long |
getMaxIdleTime()
Returns the idle time. |
int |
getReuseSessionId()
True if the server should reuse the current session id if the session doesn't exist. |
java.lang.String |
getSaveMode()
Returns the string value of the save-mode. |
SessionImpl |
getSession(java.lang.String key,
long now,
boolean create,
boolean fromCookie)
Returns a session from the session store, returning null if there's no cached session. |
int |
getSessionActiveCount()
Returns the active sessions. |
long |
getSessionCreateCount()
Returns the created sessions. |
long |
getSessionInvalidateCount()
Returns the invalidate sessions. |
int |
getSessionMax()
Returns the maximum number of sessions. |
java.lang.String |
getSessionPrefix()
Returns the session prefix, ie.. |
Store |
getSessionStore()
Returns the session store. |
long |
getSessionTimeout()
Returns the default session timeout in milliseconds. |
long |
getSessionTimeoutCount()
Returns the timeout sessions. |
int |
getSrunIndex()
Returns the index of this JVM in the ring. |
int |
getSrunLength()
Returns the number of sruns in the cluster |
java.lang.String |
getSSLCookieName()
Returns the SSL cookie name. |
void |
handleAlarm(Alarm alarm)
Timeout for reaping old sessions |
void |
init()
|
void |
invalidateSession(SessionImpl session)
Invalidates a session from the cache. |
boolean |
isClosed()
Returns true if the sessions are closed. |
boolean |
isCookieAppendServerIndex()
Sets module session id generation. |
boolean |
isCookieHttpOnly()
Returns the http-only of the session cookie. |
boolean |
isEmpty(java.lang.Object obj)
Checks if the session is empty. |
boolean |
isHessianSerialization()
Returns true for Hessian serialization. |
boolean |
isInSessionGroup(java.lang.String id)
|
boolean |
isInvalidateAfterListener()
True if the session should be invalidated after the listener. |
boolean |
isSaveAfterRequest()
True if sessions should be saved after the request. |
boolean |
isSaveBeforeFlush()
True if sessions should be saved before each flush. |
boolean |
isSaveBeforeHeaders()
True if sessions should be saved before the HTTP headers. |
boolean |
isSaveOnlyOnShutdown()
True if sessions should only be saved on shutdown. |
boolean |
isSaveOnShutdown()
True if sessions should be saved on shutdown. |
void |
load(java.io.InputStream is,
java.lang.Object obj)
Loads the session. |
void |
notifyRemove(java.lang.String id)
Notification from the cluster. |
void |
notifyUpdate(java.lang.String id)
Notification from the cluster. |
void |
removeSession(SessionImpl session)
Removes a session from the cache. |
boolean |
reuseSessionId(boolean fromCookie)
True if the server should reuse the current session id if the session doesn't exist. |
void |
setAlwaysLoadSession(boolean load)
True if sessions should always be loadd. |
void |
setAlwaysSaveSession(boolean save)
True if sessions should always be saved. |
void |
setClusterStore(boolean isEnable)
Sets the cluster store. |
void |
setCookieAppendServerIndex(boolean isAppend)
Sets module session id generation. |
void |
setCookieDomain(java.lang.String domain)
Sets the default session cookie domain. |
void |
setCookieHttpOnly(boolean httpOnly)
Sets the http-only of the session cookie. |
void |
setCookieLength(int cookieLength)
Sets the cookie length |
void |
setCookieMaxAge(Period maxAge)
Sets the max-age of the session cookie. |
void |
setCookieModuloCluster(boolean isModulo)
Sets module session id generation. |
void |
setCookiePort(java.lang.String port)
Sets the cookie ports. |
void |
setCookieSecure(boolean secure)
Sets the secure of the session cookie. |
void |
setCookieVersion(int cookieVersion)
Sets the cookie version. |
void |
setDistributionId(java.lang.String distributionId)
|
void |
setEnableCookies(boolean enableCookies)
Returns true if sessions use the cookie header. |
void |
setEnableUrlRewriting(boolean enableUrls)
Returns true if sessions can use the session rewriting. |
void |
setIgnoreSerializationErrors(boolean ignore)
True if serialization errors should just fail silently. |
void |
setInvalidateAfterListener(boolean inv)
True if the session should be invalidated after the listener. |
void |
setPersistentPath(Path path)
Returns the session factory. |
void |
setPersistentStore(JndiBuilder store)
Sets the persistent store. |
void |
setReuseSessionId(java.lang.String reuse)
True if the server should reuse the current session id if the session doesn't exist. |
void |
setSaveMode(java.lang.String mode)
Sets the save-mode: before-flush, before-headers, after-request, on-shutdown |
void |
setSaveOnlyOnShutdown(boolean save)
True if sessions should only be saved on shutdown. |
void |
setSaveOnShutdown(boolean save)
True if sessions should only be saved on shutdown. |
void |
setSerializationType(java.lang.String type)
Sets the serialization type. |
void |
setSessionMax(int max)
Returns the maximum number of sessions. |
void |
setSessionTimeout(long timeout)
Set the default session timeout in minutes |
void |
setTcpStore(boolean isEnable)
Sets the tcp store. |
void |
setUsePersistentStore(boolean enable)
Sets the cluster store. |
void |
start()
|
void |
store(java.io.OutputStream os,
java.lang.Object obj)
Saves the session. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final L10N L
protected static final java.util.logging.Logger log
| Constructor Detail |
|---|
public SessionManager(WebApp app)
throws java.lang.Exception
app - the web-app webAppregistry - the web-app configuration node
java.lang.Exception| Method Detail |
|---|
public SessionManagerMXBean getAdmin()
protected Cluster getCluster()
public java.lang.String getSessionPrefix()
public java.lang.String getAlternateSessionPrefix()
public int getCookieVersion()
public void setCookieVersion(int cookieVersion)
public void setCookiePort(java.lang.String port)
public java.lang.String getCookiePort()
public java.util.logging.Logger getDebug()
public void setPersistentStore(JndiBuilder store)
throws javax.naming.NamingException,
ConfigException
javax.naming.NamingException
ConfigExceptionpublic void setAlwaysLoadSession(boolean load)
public void setAlwaysSaveSession(boolean save)
public boolean isSaveOnShutdown()
public boolean isSaveOnlyOnShutdown()
public boolean isSaveBeforeHeaders()
public boolean isSaveBeforeFlush()
public boolean isSaveAfterRequest()
public void setSaveMode(java.lang.String mode)
throws ConfigException
ConfigExceptionpublic java.lang.String getSaveMode()
public void setSaveOnlyOnShutdown(boolean save)
public void setSaveOnShutdown(boolean save)
public void setSerializationType(java.lang.String type)
public boolean isHessianSerialization()
public void setInvalidateAfterListener(boolean inv)
public boolean isInvalidateAfterListener()
public int getActiveSessionCount()
public int getSessionActiveCount()
public long getSessionCreateCount()
public long getSessionTimeoutCount()
public long getSessionInvalidateCount()
public void addListener(HttpSessionListener listener)
public void addActivationListener(HttpSessionActivationListener listener)
public void addAttributeListener(HttpSessionAttributeListener listener)
public void setIgnoreSerializationErrors(boolean ignore)
public int getReuseSessionId()
public boolean reuseSessionId(boolean fromCookie)
public void setReuseSessionId(java.lang.String reuse)
throws ConfigException
ConfigExceptionpublic int getSrunIndex()
public int getSrunLength()
public boolean isClosed()
public StoreManager createFileStore()
throws ConfigException
ConfigException
public StoreManager createJdbcStore()
throws ConfigException
ConfigException
public void setTcpStore(boolean isEnable)
throws java.lang.Exception
java.lang.Exception
public void setClusterStore(boolean isEnable)
throws java.lang.Exception
java.lang.Exception
public void setUsePersistentStore(boolean enable)
throws java.lang.Exception
java.lang.Exceptionpublic void setPersistentPath(Path path)
public java.lang.String getDistributionId()
public void setDistributionId(java.lang.String distributionId)
public long getSessionTimeout()
public void setSessionTimeout(long timeout)
public long getMaxIdleTime()
getMaxIdleTime in interface ObjectManagerpublic int getSessionMax()
public void setSessionMax(int max)
public boolean enableSessionCookies()
public void setEnableCookies(boolean enableCookies)
public boolean enableSessionUrls()
public void setEnableUrlRewriting(boolean enableUrls)
public java.lang.String getCookieName()
public java.lang.String getSSLCookieName()
public java.lang.String getCookieDomain()
public void setCookieDomain(java.lang.String domain)
public long getCookieMaxAge()
public void setCookieMaxAge(Period maxAge)
public boolean getCookieSecure()
public void setCookieSecure(boolean secure)
public boolean isCookieHttpOnly()
public void setCookieHttpOnly(boolean httpOnly)
public void setCookieLength(int cookieLength)
public long getCookieLength()
public void setCookieModuloCluster(boolean isModulo)
public void setCookieAppendServerIndex(boolean isAppend)
public boolean isCookieAppendServerIndex()
public void init()
public void start()
throws java.lang.Exception
java.lang.Exceptionpublic Store getSessionStore()
public boolean containsSession(java.lang.String id)
public SessionImpl createSession(java.lang.String oldId,
long now,
HttpServletRequest request,
boolean fromCookie)
oldId - the id passed to the request. Reuse if possible.now - the current datesessionGroup - the srun index for this machinepublic java.lang.String createSessionId(HttpServletRequest request)
sessionGroup - possibly assigned by the web server
public java.lang.String createSessionId(HttpServletRequest request,
boolean create)
sessionGroup - possibly assigned by the web serverpublic java.lang.String createSessionIdImpl(HttpServletRequest request)
public SessionImpl getSession(java.lang.String key,
long now,
boolean create,
boolean fromCookie)
key - the session idnow - the time in milliseconds
public boolean isInSessionGroup(java.lang.String id)
public void notifyRemove(java.lang.String id)
notifyRemove in interface ObjectManagerpublic void notifyUpdate(java.lang.String id)
notifyUpdate in interface ObjectManagerpublic static int decode(int code)
public void invalidateSession(SessionImpl session)
public void removeSession(SessionImpl session)
public void load(java.io.InputStream is,
java.lang.Object obj)
throws java.io.IOException
load in interface ObjectManagerin - the input stream containing the serialized sessionobj - the session object to be deserialized
java.io.IOExceptionpublic boolean isEmpty(java.lang.Object obj)
isEmpty in interface ObjectManager
public void store(java.io.OutputStream os,
java.lang.Object obj)
throws java.io.IOException
store in interface ObjectManagerjava.io.IOExceptionpublic void handleAlarm(Alarm alarm)
handleAlarm in interface AlarmListenerpublic void close()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||