dfischer.femtowebserver.httpd
Class HttpdSessionHashtable
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--dfischer.femtowebserver.httpd.HttpdSessionHashtable
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class HttpdSessionHashtable
- extends java.util.Hashtable
Contains and manages all HTTP sessions of one Femto Web Server instance.
During the call of the Httpd constructor a session hashtable will automatically
created. This (default) instance is accessable from HttpdProperties.getSessionHashtable().
That the Femto Web Server supports HTTP sessions, a special HttpdFilter must first be added to the Httpd
which generates and manages all sessions. Implementing a own HttpdFilter to manage in
collaboration with the HttpdSessionHashtable the sessions is fully supported - but the easier way is to use
the already implemented HttpSessionCookieHandler.
- See Also:
HttpdSession,
Httpd.setSessionHashtable(dfischer.femtowebserver.httpd.HttpdSessionHashtable),
HttpdFilter,
Httpd.addFilter(String, String[]), Serialized Form
| Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
|
Method Summary |
void |
addSession(java.lang.String sessionId,
HttpdSession httpdSession)
Adds a new session to the hashtable. |
void |
dropInactiveSessions(int inactiveMinutes)
Removes all sessions that are inactive since a specific time. |
void |
dropLongSessions(int maxSessionTime)
Removes all sessions that are older since a specific time. |
HttpdSession |
getSession(java.lang.String sessionId)
Returns a session selected by its session id. |
void |
removeSession(java.lang.String sessionId)
Removes a session from the hashtable. |
| Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
HttpdSessionHashtable
public HttpdSessionHashtable()
- Creates a new session hashtable. The Httpd has already done this, so
that only classes which extend this class should call the constructor with super().
- See Also:
Httpd.setSessionHashtable(dfischer.femtowebserver.httpd.HttpdSessionHashtable)
addSession
public void addSession(java.lang.String sessionId,
HttpdSession httpdSession)
- Adds a new session to the hashtable.
- Parameters:
sessionId - the session id of the session. This should be an unique, random value.
If an other session already exists with the same session id it will be
overwritten (and lost).httpdSession - the session to add
getSession
public HttpdSession getSession(java.lang.String sessionId)
- Returns a session selected by its session id.
- Parameters:
sessionId - the session id of the selected session.- Returns:
- the selected session or null, if no session with the given session id was found.
removeSession
public void removeSession(java.lang.String sessionId)
- Removes a session from the hashtable.
- Parameters:
sessionId - the session id of the session to remove. If no session with the given
session id was found this method completes still successful.
dropInactiveSessions
public void dropInactiveSessions(int inactiveMinutes)
- Removes all sessions that are inactive since a specific time. This method compares
the last access time of each session with the current time and removes the session
from the hashtable, if the time difference is greater than the specified input value.
- Parameters:
inactiveMinutes - maximum number of minutes that a session can be inactive
without it will be deleted.- See Also:
HttpdSession.getLastAccessTime()
dropLongSessions
public void dropLongSessions(int maxSessionTime)
- Removes all sessions that are older since a specific time. This method compares
the creation time of each session with the current time and removes the session
from the hashtable, if the time difference is greater than the specified input value.
- Parameters:
maxSessionTime - maximum number of minutes that a session can life
without it will be deleted.- See Also:
HttpdSession.getCreationTime()
Copyright 2002, 2003, 2006 by Ingenieurbüro David Fischer GmbH, Switzerland. All rights reserved.