类 FileSessionPersister

java.lang.Object
cn.taketoday.session.FileSessionPersister
所有已实现的接口:
SessionPersister

public class FileSessionPersister extends Object implements SessionPersister
Concrete implementation of the SessionPersister interface that utilizes a file per saved Session in a configured directory. Sessions that are saved are still subject to being expired based on inactivity.
从以下版本开始:
4.0 2023/2/27 21:43
作者:
Craig R. McClanahan, Harry Yang
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    private cn.taketoday.core.ApplicationTemp
     
    private File
    The directory in which Sessions are stored.
    private static final String
    The extension to use for serialized session filenames.
    private static final cn.taketoday.logging.Logger
     
    private final SessionRepository
     
  • 构造器概要

    构造器
    构造器
    说明
    Creates FileSessionPersister with given SessionRepository
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    Remove all of the Sessions in this Store.
    boolean
    contains session with given id
    private File
    Return a File object representing the pathname to our session persistence directory, if any.
    Return an array containing the session identifiers of all Sessions currently saved in this Store.
    Load and return the WebSession associated with the specified session identifier from this Store, without removing it.
    void
    Remove the Session with the specified session identifier from this SessionPersister, if present.
    void
    save(WebSession session)
    Save the specified Session into this Store.
    private File
    Return a File object representing the pathname to our session persistence file, if any.
    void
    setApplicationTemp(cn.taketoday.core.ApplicationTemp applicationTemp)
    Set the app temp provider for this SessionPersister.
    void
    setDirectory(File directory)
    Set the store directory for this SessionPersister.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • log

      private static final cn.taketoday.logging.Logger log
    • FILE_EXT

      private static final String FILE_EXT
      The extension to use for serialized session filenames.
      另请参阅:
    • directory

      @Nullable private File directory
      The directory in which Sessions are stored.
    • applicationTemp

      @Nullable private cn.taketoday.core.ApplicationTemp applicationTemp
    • repository

      private final SessionRepository repository
  • 构造器详细资料

    • FileSessionPersister

      public FileSessionPersister(SessionRepository repository)
      Creates FileSessionPersister with given SessionRepository
      参数:
      repository - used to create session
      另请参阅:
  • 方法详细资料

    • setDirectory

      public void setDirectory(@Nullable File directory)
      Set the store directory for this SessionPersister.
      参数:
      directory - The store directory
    • setApplicationTemp

      public void setApplicationTemp(@Nullable cn.taketoday.core.ApplicationTemp applicationTemp)
      Set the app temp provider for this SessionPersister.
      参数:
      applicationTemp - The app temp provider
    • remove

      public void remove(String id) throws IOException
      Remove the Session with the specified session identifier from this SessionPersister, if present. If no such Session is present, this method takes no action.
      指定者:
      remove 在接口中 SessionPersister
      参数:
      id - Session identifier of the Session to be removed
      抛出:
      IOException
    • contains

      public boolean contains(String id)
      从接口复制的说明: SessionPersister
      contains session with given id
      指定者:
      contains 在接口中 SessionPersister
    • clear

      public void clear() throws IOException
      Remove all of the Sessions in this Store.
      指定者:
      clear 在接口中 SessionPersister
      抛出:
      IOException - if an input/output error occurs
    • keys

      public String[] keys()
      Return 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.
      指定者:
      keys 在接口中 SessionPersister
      返回:
      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.
    • load

      @Nullable public WebSession load(String id) throws ClassNotFoundException, IOException
      Load and return the WebSession associated with the specified session identifier from this Store, without removing it. If there is no such stored WebSession, return null.
      指定者:
      load 在接口中 SessionPersister
      参数:
      id - Session identifier of the session to load
      返回:
      the loaded Session instance
      抛出:
      ClassNotFoundException - if a deserialization error occurs
      IOException - if an input/output error occurs
    • save

      public void save(WebSession session) throws IOException
      Save the specified Session into this Store. Any previously saved information for the associated session identifier is replaced.
      指定者:
      save 在接口中 SessionPersister
      参数:
      session - Session to be saved
      抛出:
      IOException - if an input/output error occurs
    • directory

      private File directory()
      Return a File object representing the pathname to our session persistence directory, if any. The directory will be created if it does not already exist.
    • sessionFile

      private File sessionFile(String id)
      Return a File object representing the pathname to our session persistence file, if any.
      参数:
      id - The ID of the Session to be retrieved. This is used in the file naming.