Package org.apache.catalina.session
Class FileStore
- java.lang.Object
-
- org.apache.catalina.util.LifecycleBase
-
- org.apache.catalina.session.StoreBase
-
- org.apache.catalina.session.FileStore
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
Lifecycle.SingleUse
-
-
Field Summary
-
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description FileStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Remove all Sessions from this Store.java.lang.StringgetDirectory()intgetSize()java.lang.StringgetStoreName()java.lang.StringgetThreadName()java.lang.String[]keys()Sessionload(java.lang.String id)Load and return the Session associated with the specified session identifier from this Store, without removing it.voidremove(java.lang.String id)Remove the Session with the specified session identifier from this Store, if present.voidsave(Session session)Save the specified Session into this Store.voidsetDirectory(java.lang.String path)Set the directory path for this Store.-
Methods inherited from class org.apache.catalina.session.StoreBase
addPropertyChangeListener, destroyInternal, expiredKeys, getManager, getObjectInputStream, initInternal, processExpires, removePropertyChangeListener, setManager, startInternal, stopInternal, toString
-
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
-
-
-
-
Method Detail
-
getDirectory
public java.lang.String getDirectory()
- Returns:
- The directory path for this Store.
-
setDirectory
public void setDirectory(java.lang.String path)
Set the directory path for this Store.- Parameters:
path- The new directory path
-
getThreadName
public java.lang.String getThreadName()
- Returns:
- The thread name for this Store.
-
getStoreName
public java.lang.String getStoreName()
- Overrides:
getStoreNamein classStoreBase- Returns:
- the name for this Store, used for logging.
-
getSize
public int getSize() throws java.io.IOException- Returns:
- the number of Sessions present in this Store.
- Throws:
java.io.IOException- if an input/output error occurs
-
clear
public void clear() throws java.io.IOExceptionDescription copied from interface:StoreRemove all Sessions from this Store.- Throws:
java.io.IOException- if an input/output error occurs
-
keys
public java.lang.String[] keys() throws java.io.IOException- Returns:
- an array containing the session identifiers of all Sessions currently saved in this Store. If there are no such Sessions, a zero-length array is returned.
- Throws:
java.io.IOException- if an input/output error occurred
-
load
public Session load(java.lang.String id) throws java.lang.ClassNotFoundException, java.io.IOException
Description copied from interface:StoreLoad and return the Session associated with the specified session identifier from this Store, without removing it. If there is no such stored Session, returnnull.Implementations should expect, and correctly handle, concurrent calls to any method but in particular calls to
#load(String),#save(Session)and#remove(String)for the same session.The session ID is user provided so stores must treat it as untrusted data.
- Parameters:
id- Session identifier of the session to load- Returns:
- the loaded Session instance
- Throws:
java.lang.ClassNotFoundException- if a deserialization error occursjava.io.IOException- if an input/output error occurs
-
remove
public void remove(java.lang.String id) throws java.io.IOExceptionDescription copied from interface:StoreRemove the Session with the specified session identifier from this Store, if present. If no such Session is present, this method takes no action.Implementations should expect, and correctly handle, concurrent calls to any method but in particular calls to
#load(String),#save(Session)and#remove(String)for the same session.The session ID is user provided so stores must treat it as untrusted data.
- Parameters:
id- Session identifier of the Session to be removed- Throws:
java.io.IOException- if an input/output error occurs
-
save
public void save(Session session) throws java.io.IOException
Description copied from interface:StoreSave the specified Session into this Store. Any previously saved information for the associated session identifier is replaced.Implementations should expect, and correctly handle, concurrent calls to any method but in particular calls to
#load(String),#save(Session)and#remove(String)for the same session.- Parameters:
session- Session to be saved- Throws:
java.io.IOException- if an input/output error occurs
-
-