Version: 9.4.2.v20170220 |

Non-Clustered Session Management: File System
Previous | Chapter 10. Session Management Home | Next

##### Contact the core Jetty developers at www.webtide.com

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

## Non-Clustered Session Management: File System

When using the Jetty distribution, you will first need to enable the `session-store-file` module for your Jetty base using the `--add-to-start` argument on the command line.

    $ java -jar ../start.jar --create-startd
    INFO : Base directory was modified

    $ java -jar ../start.jar --add-to-start=session-store-file
    INFO : server          initialised (transitively) in ${jetty.base}/start.d/server.ini
    INFO : sessions        initialised (transitively) in ${jetty.base}/start.d/sessions.ini
    INFO : session-store-file initialised in ${jetty.base}/start.d/session-store-file.ini
    MKDIR: ${jetty.base}/sessions
    INFO : Base directory was modified

Doing this enables the File System Session module and any dependent modules or files needed for it to run on the server. The example above is running an fresh `${jetty.base}` with nothing enabled. When the `--add-to-start` argument was added to the command line, it enabled the the `session-store-file` module as well as the `sessions` and `server` modules, which are required for the File System session management to operate. Additionally a `${jetty.base}/sessions` directory was created. By default Session files will be saved to this directory.

In addition to adding these modules to the classpath of the server it also added several ini configuration files to the `start.d` directory of the `${jetty.base}`.

Opening the `start.d/session-store-file.ini` will show a list of all the configurable options for the file system session module:

    # ---------------------------------------
    # Module: session-store-file
    # Enables session persistent storage in files.
    # ---------------------------------------
    --module=session-store-file

    jetty.session.file.storeDir=${jetty.base}/sessions
    #jetty.session.file.deleteUnrestorableFiles=false

jetty.session.storeDir
  This defines the location for storage of Session files.
jetty.session.file.deleteUnrestorableFiles
  Boolean. If set to true, unreadable files will be deleted: this is useful to prevent repeated logging of the same error when the scavenger periodically (re-) attempts to load the corrupted information for a session in order to expire it.

Previous | Top | Next
Non-Clustered Session Management: Memory | Home | Clustered Session Management: JDBC

See an error or something missing? Contribute to this documentation at Github!(Generated: 2017-02-20)